Java: An Introduction to Problem Solving and Programming (7th Edition)
Java: An Introduction to Problem Solving and Programming (7th Edition)
7th Edition
ISBN: 9780133766264
Author: Walter Savitch
Publisher: PEARSON
bartleby

Concept explainers

Question
Book Icon
Chapter 7, Problem 8PP
Program Plan Intro

Shoulder surfing

Program Plan:

  • Import required package.
  • Define “AuthenticateTest” class.
    • Define main function.
      • Initializes actual PIN.
      • Create an array “randomDigits” for randomly generated digits.
      • Create an array “userEnteredDigits” for digits entered by the user.
      • Generate random numbers from “1” to “3” for each digit using for loop.
      • Display the sequence of PIN and NUM to screen.
      • Display “10” digits random numbers for “NUM”.
      • Create object for scanner class.
      • Display user prompt statement.
      • Read the five digits PIN number from user.
      • Extract the digits from the code and store in the “userEnteredDigits” array.
        • Convert char to corresponding digit.
      • Check whether the user entered password is equal to random PIN number of actual PIN numbers by calling the method “checkValidPassword()”.
        • If it is match, then display the message “Your password matches correctly!”.
        • Otherwise, display the message “Invalid password.”.
      • Define the boolean method “checkValidPassword()” with three arguments
        • Check PIN numbers one by one using “for” loop. If the user entered PIN is not equal to actual PIN, then returns “false”.

Blurred answer
Students have asked these similar questions
You have a card on which the letter J is written on one side and K on the other. You want to seeall of the possible ways the card will land if you drop it n times. Write a recursive method thatprints each session of dropping the cards with J's and K's. For example if you drop it 4 times in agiven session, all possible ways to drop it are as follows (in exactly the specified order): J J J JJ J J KJ J K JJ J K KJ K J JJ K J KJ K K JJ K K KK J J JK J J KK J K JK J K KK K J JK K J KK K K JK K K K
Mastermind is a code-breaking game for two players. In the original real-world game, one player A selects 4 pegs out of 6 colors and puts them in a certain fixed order; multiples of colors are possible (for example, red-green red-green). His opponent B does not know the colors or order but has to find out the secret code. To do so, B makes a series of guesses, each evaluated by the first player. A guess consists of an ordered set of colors which B believes is the code. The first player A evaluates the guess and feeds back to B how many positions and colors are correct. A position is correct ("black") if the guess and the secret code have the same color. Additional colors are correct ("white"), if they are in the guess and the code, but not at the same location. For example1 2 3 4secret: red-green red greenguess: red blue green purpleresults in one correct position ("black = 1") for the red peg at position one and one additional correct color ("white=1") for the green peg in the guess.…
Mastermind is a code-breaking game for two players. In the original real-world game, one player A selects 4 pegs out of 6 colors and puts them in a certain fixed order; multiples of colors are possible (for example, red-green red-green). His opponent B does not know the colors or order but has to find out the secret code. To do so, B makes a series of guesses, each evaluated by the first player. A guess consists of an ordered set of colors which B believes is the code. The first player A evaluates the guess and feeds back to B how many positions and colors are correct. A position is correct ("black") if the guess and the secret code have the same color. Additional colors are correct ("white"), if they are in the guess and the code, but not at the same location. For example1 2 3 4secret: red-green red greenguess: red blue green purpleresults in one correct position ("black = 1") for the red peg at position one and one additional correct color ("white=1") for the green peg in the guess.…

Chapter 7 Solutions

Java: An Introduction to Problem Solving and Programming (7th Edition)

Ch. 7.2 - Give the definition of a static method called...Ch. 7.2 - Prob. 12STQCh. 7.2 - The following method compiles and executes but...Ch. 7.2 - Suppose that we add the following method to the...Ch. 7.3 - Prob. 15STQCh. 7.3 - Replace the last loop in Listing 7.8 with a loop...Ch. 7.3 - Suppose a is an array of values of type double....Ch. 7.3 - Suppose a is an array of values of type double...Ch. 7.3 - Prob. 19STQCh. 7.3 - Consider the partially filled array a from...Ch. 7.3 - Repeat the previous question, but this time assume...Ch. 7.3 - Write an accessor method getEntryArray for the...Ch. 7.4 - Prob. 23STQCh. 7.4 - Write the invocation of the method selectionSort...Ch. 7.4 - How would you need to change the method...Ch. 7.4 - How would you need to change the method...Ch. 7.4 - Consider an array b of int values in which a value...Ch. 7.5 - What output is produced by the following code?...Ch. 7.5 - Revise the method showTable in Listing 7.13 so...Ch. 7.5 - Write code that will fill the following array a...Ch. 7.5 - Write a void method called display such that the...Ch. 7.6 - Prob. 33STQCh. 7 - Write a program in a class NumberAboveAverage that...Ch. 7 - Write a program in a class CountFamiles that...Ch. 7 - Write a program in a class CountPoor that counts...Ch. 7 - Write a program in a class FlowerCounter that...Ch. 7 - Write a program in a class characterFrequency that...Ch. 7 - Create a class Ledger that will record the sales...Ch. 7 - Define the following methods for the class Ledger,...Ch. 7 - Write a static method isStrictlyIncreasing (double...Ch. 7 - Write a static method removeDuplicates(Character[]...Ch. 7 - Write a static method remove {int v, int [] in}...Ch. 7 - Suppose that we are selling boxes of candy for a...Ch. 7 - Create a class polynomial that is used to evaluate...Ch. 7 - Write a method beyond LastEntry (position) for the...Ch. 7 - Revise the class OneWayNoRepeatsList, as given in...Ch. 7 - Write a static method for selection sort that will...Ch. 7 - Overload the method selectionSort in Listing 7.10...Ch. 7 - Revise the method selectionSort that appears in...Ch. 7 - Prob. 18ECh. 7 - Write a sequential search of an array of integers,...Ch. 7 - Write a static method findFigure (picture,...Ch. 7 - Write a static method blur (double [] [] picture)...Ch. 7 - Write a program that reads integers, one per line,...Ch. 7 - The following code creates a small phone book. An...Ch. 7 - Write the method rotateRight that takes an array...Ch. 7 - The following code creates a ragged 2D array. The...Ch. 7 - Write a program that will read a line of text that...Ch. 7 - Prob. 2PPCh. 7 - Add a method bubbleSort to the class ArraySorter,...Ch. 7 - Add a method insertionSort to the class...Ch. 7 - The class TimeBook in Listing 7.14 is not really...Ch. 7 - Define a class called TicTacToe. An object of type...Ch. 7 - Repeat Programming Project 10 from Chapter 5 but...Ch. 7 - Prob. 8PPCh. 7 - Write a GUI application that displays a picture of...Ch. 7 - ELIZA was a program written in 1966 that parodied...Ch. 7 - Prob. 11PPCh. 7 - Create a GUI application that draws the following...Ch. 7 - Practice Program 2 used two arrays to implement a...Ch. 7 - Practice Program 5.4 asked you to define Trivia...
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education