Program that helps to test knowledge of colors and shapes


Question 1) Write a program that helps teachers to test their students in their knowledge with colors and shapes. The program consists of two classes ColorShape and testColorShape. Class ColorShape has two instant variables choiceColor and choiceShape (both int). Your class must also have a constructor and the setMethod for the instant variables.

In your test class you must use JFrames to show the shape of certain color (for example a red square). You require to start first by asking about shape and then about the color using JOptionPane. Whether answer is wrong or right the user must be shown another question (new colored shape) and you require to state that answer was correct or incorrect. If the student enters a 0 as an answer (either for color or shape) for a question the program must exit.

Important Notes:

Your require to generate the shapes and colors randomly using random numbers

In order to show new shape for the new question, you need to set the JFrame as invisible, change the settings of your JFrame and then set it back to visible using the following command

Application.setVisible(false); a invisible

Application.setVisible(true); a visible

When the user input a zero in any field, the program would exit

If you faced a problem in closing the JFrames use the following command

System.exit(0)

Your frame must be of reasonable size and the shapes must be clear and centered

The user must enter both choices then the program specifies if the answer is correct or not.

Request for Solution File

Ask an Expert for Answer!!
JAVA Programming: Program that helps to test knowledge of colors and shapes
Reference No:- TGS04597

Expected delivery within 24 Hours