Question: Need help for writing a Java program for having a user guess a secret number Program 4. Secret Number (50 points) Write a program to
Program 4. Secret Number (50 points) Write a program to generate a random number between 1 - 100 and keep it as a secret number. The program will then check if a user can guess the secret number. The user can continue guessing the number until the number is found or the user can enter 0, which will terminate the program Each time the user makes a guess, the program will report as below: 1. Way Too High or Way Too Low (more than 30 off) 1. Way Too High or Way Too Low (more than 30 of) 2. High or Low (between 10 and 30 points off) 3. A Little High or A Little Low (less than 10 points off) If secret number is 74 and the user enters 26, the program will print "Way too Low". If the user then says 65, then the program will print "A Little Low". Write the program using JoptionPane. Name this program SecretNumber.java Note: The method showInputDialog in JOptionPane returns a string for the value entered by the user. To convert the string to an integer, use the wrapper class Integer. For example: with int I; String inputString; You can use = Integer.parseInt(inputString)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
