Question: Java a) Basic capability: write a program that tests the user's ability to memorize a nandom sequence of colors. As shown in the sample session,

Java  Java a) Basic capability: write a program that tests the user's
ability to memorize a nandom sequence of colors. As shown in the

a) Basic capability: write a program that tests the user's ability to memorize a nandom sequence of colors. As shown in the sample session, the program starts off by displaying a JOptionPane dialog box with alist ofcolorsthat are to be memorized red, white, yellow, geen, and blue. The user then uses a form you create to enter the colors one tatime into a text box Ifthe user guesses the color correctly, the text box is cleared and the user is asked to enter the next color. Ifthe user makes a mistake, the program prints a "Sorry" message. If the user correctly erntersall five colors correctly, the program prints a Congratulations" a message. Note that when the sorry or congratulations message isprinted, the window's components get cleared away, so that the user cannot enter any more text. always, you are required to write elegant code. In particular, you should avoid hard coding the color values in the interior of your program. You should declare those values one time in an array at the top of the program. Note: Your program should contain a class named MemoryGame. Use a simple FlowHLayout layout manager scheme. Use an inner class for the listener. First sample session (read the windows left to ri The opening dialog box: After closing the dialog box, here's the main window. Memory Game n Enter color number 1: Message How good is your memory? Try to memorize this color sequence: red white yellow green blue After pressing enter and then typing the second color: After typing the first color: Memory Game Memory Game Enter color number 2. white Enter color number 1: red

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!