Question: Write a driver program named SecretCode that generates a random number three-digit number. Ask the user to guess the number. Tell the user which if
Write a driver program named SecretCode that generates a random number three-digit number. Ask the user to guess the number. Tell the user which if any of the digits are correct. Let them guess again until they get it correct.
After they guess correctly, tell them how many guesses it took. Ask them if they want to play again (answer with yes or no). SAMPLE OUTPUT:
Sample Output Secret Code.java ***FOR DEBUGGING ONLY The computer numbers are 7 17 Guess a three digit number 711 The user numbers are 7 11 Your 7 matches Your 1 matches Guess a three digit number 123 The user numbers are 1 2 3 None of your matched. Guess a three digit number 747 The user numbers are 7 4 7 Your 7 matches Your 7 matches Guess a three digit number 747 The user numbers are 7 4 7 Your 7 matches Your 7 matches Guess a three digit number 717 The user numbers are 7 1 7 Your 7 matches Your 1 matches Your 7 matches You got it! It took 5 gueses Do you want to play again? (yes or no) yes ***FOR DEBUGGING ONLY The computer numbers are 5 1 9 Guess a three digit number 519 The user numbers are 5 1 9 Your 5 matches Your 1 matches Your 9 matches You got it! It took 1 guesses Do you want to play again? (yes or no) yes ***FOR DEBUGGING ONLY The computer numbers are 8 7 8 Guess a three digit number 899 The user numbers are 8 9 9 Your 8 matches Guess a three digit number 873 The user numbers are 8 7 3 Your 8 matches Your 7 matches Guess a three digit number 878 The user numbers are 8 7 8 Your 8 matches Your 7 matches Your 8 matches You got it! It took 3 guesses Do you want to play again? (yes or no)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
