Question: Create an applet or GUI that plays a simple guessing game. Give it two buttons labeled Odd and Even. The user must guess whether a

Create an applet or GUI that plays a simple guessing game. Give it two buttons labeled Odd and Even. The user must guess whether a secret number is odd or even by clicking one of these buttons. After a guess is made, the applet should display either Congratulations, you are correct! or Sorry, you are wrong. In either case, also display The secret number was: followed by the secret number. Use labels for these three messages.

The applet will have a private instance variable secretNumber of type long that holds the secret number. You will need to set it in the init method using the following line of code: secretNumber = java.util.Calendar.getInstance().getTimeInMillis() % 100; In the actionPerformed method, check which button was pressed and make the appropriate response label visible. After that, make the two buttons invisible (only one guess is allowed) and the label containing the secret number visible.

please if you cant do it dont waste my question.

add comments to code please

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!