Create a new project within Eclipse using your own name as its title e.g. “firstname_lastname_ca2”. This program will be based on the concept of a “Guessing Game” using an Applet that runs in a web browser. The Applet should do the following:

  • Open with two buttons – “Begin Game” and “Answer”. Background should be red. A label should be set to the right of both buttons initially displaying “Click „Begin‟ to start the game”.
  • The Secret Number should be: 8

Three Incorrect Guesses and You‟re Out

  • When the user clicks the “Begin Game” button, an input dialog box should request a guess from the user. If the guess is incorrect, a white rectangular box displays text informing the user “Incorrect, try again!” The button text changes to “Guess 2”. The label changes to “You Guessed: 12” (for example)”. This process continues until the user reaches the third guess.
  • When the user clicks the “Guess: 3” button, an input dialog box should request a guess from the user. If the guess is incorrect, a white rectangular box displays text informing the user “Incorrect, try again!”. A dialog box appears stating “You are out of Guesses”. The button text changes to “Play Again?”The label changes to “You Guessed: 18” (for example)”. Clicking the “Play Again” button restarts the game and allows the user a further three guesses.

Within a Range of Two

  • If the user comes within a range of “2” of the secret number, a white oval displays text informing the user “Your guess is 2 +/- the secret number!”

Correct Guess

  • If at any point, the user enters 8 (the secret number), the background turns green, the label displays “You Guessed: 8” and a message dialog box informs the user “Congratulations, you guessed correctly!” The applet ceases executing.

Answer button

  • Clicking the “Answer” button simply displays – “The Secret Number is 8”. The applet then ceases execution.

Screenshots: Figure 1 and 2. Figure 3 and 4. Figure 5.

Academic Honesty!
It is not our intention to break the school's academic policy. Projects posted are only used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly fill out the form. Please provide a valid email address and we'll get back to you in less than 24 hours. We will be sending an invoice through PayPal upon confirmation. We are a non profit organization however we need an amount to keep this organization running, and to be able to complete our research and development.