Question
you can copy the following statement to generate and use a dialog box that displays a random number between 1 and 10: JOptionPane.showMessageDialog(null,The number is
you can copy the following statement to generate and use a dialog box that displays a random number between 1 and 10:
JOptionPane.showMessageDialog(null,"The number is "+
(1 + (int)(Math.random() * 10)));
Write a Java application that displays two dialog boxes in sequence. The first asks you to think of a number between 1 and 10. The second displays a randomly generated number; the user can see whether his or her guess was accurate. (In future chapters, you will improve this game so that the user can enter a guess and the program can determine whether the user was correct. If you wish, you also can tell the user how far off the guess was, whether the guess was high or low, and provide a specific number of repeat attempts.)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started