Question: JAVA PROGRAM:GuessAColor GuessAColor A JAVA program that matches a random color chosen by the computer. - The user must enter the name of the color

JAVA PROGRAM:GuessAColor

JAVA PROGRAM:GuessAColor GuessAColor A JAVA program that matches a random color chosen

by the computer. - The user must enter the name of the

GuessAColor A JAVA program that matches a random color chosen by the computer. - The user must enter the name of the color - not a number that refers to a certain color. - The randomly generated number for the computer color must be converted to the appropriate name. - Ask the user how many times they want to play and print out the percentage of the time that they guess correctly. - The main() method should look like - public static void main(String[] args) \{ runGame(); \} Information on methods above: GuessAColor() - you do not code this. The no-arg constructor that Java must have. main () - see above runGame( ) - has the main loop and counter for the game getUserColor() - asks the user for the name of their color and returns it getCompColor () - takes the random integer value generated in runGame() and returns the name of the color assigned to that value checkCorrect () - passes in the user color and computer color for one guess and returns true or false printResults () - takes the boolean from checkCorrect() and prints the results for that one guess printPctCorrect(takes in the number of games and number correct and returns the final results of the percentage correct. Sample output (must be exact) How many times do you want to play? (5 is a good number) 6 Guess a color: blue, red, white, or purple blue The computer's color was white You and the computer did not match Guess a color: blue, red, white, or purple blue The computer's color was red You and the computer did not match Guess a color: blue, red, white, or purple blue The computer's color was red You and the computer did not match Guess a color: blue, red, white, or purple blue The computer's color was blue You matched the computer Guess a color: blue, red, white, or purple blue The computer's color was blue You matched the computer Guess a color: blue, red, white, or purple blue The computer's color was purple You and the computer did not match In 6 guesses, you matched the computer 2 times The percent correct was 33.3%

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!