Purchase Solution

Java program to memorize a sequence of colors

Not what you're looking for?

Ask Custom Question

Write a program that tests the user's ability to memorize a sequence of colors. As shown in the sample session, the program starts off by displaying a dialog box with a list of colors that are to be memorized - red, white, yellow, green, and blue. The user then enters the colors one at a time in a text box. If the user makes a mistake, the program prints a "Sorry" message. If the user correctly enters all the colors, the program prints a "Congratulations" message. Note that when the sorry or congratulations message is printed, the window's original components get cleared away.

Attachments
Purchase this Solution

Solution Summary

A java program in a single java file. When launched you will see a question "How good is your memory? Try to memorize following color sequence: [color list]". Then the form will appear where the user can enter his guess. If the user correctly enters all the colors, the program prints a "Congratulations" message. Solution is provided in two versions using JApplet or JFrame. Choose whichever required.

Solution Preview

Please find below the java code. The list of colors are stored in the colors string array. Variable guessNumber keeps track of guess attempts made starting from 0 (it is easier to access color array items since they start from ...

Purchase this Solution


Free BrainMass Quizzes
Word 2010: Table of Contents

Ever wondered where a Table of Contents in a Word document comes from? Maybe you need a refresher on the topic? This quiz will remind you of the keywords and options used when working with a T.O.C. in Word 2010.

Basic UNIX commands

Use this quiz to check your knowledge of a few common UNIX commands. The quiz covers some of the most essential UNIX commands and their basic usage. If you can pass this quiz then you are clearly on your way to becoming an effective UNIX command line user.

Java loops

This quiz checks your knowledge of for and while loops in Java. For and while loops are essential building blocks for all Java programs. Having a solid understanding of these constructs is critical for success in programming Java.

Basic Computer Terms

We use many basic terms like bit, pixel in our usual conversations about computers. Are we aware of what these mean? This little quiz is an attempt towards discovering that.

Excel Introductory Quiz

This quiz tests your knowledge of basics of MS-Excel.