File Guessing.java contains a skeleton of a program that plays a simple guessing
ID: 3528239 • Letter: F
Question
File Guessing.java contains a skeleton of a program that plays a simple guessing game with the user. Using the comments as a guide, complete the program so that it prints out the result of the guessing. //******************************************************************* // Guessing.java // //******************************************************************* import java.util.*; public class Guessing { //----------------------------------------------------------------- // Plays a simple guessing game with the user. //----------------------------------------------------------------- public static void main (String[] args) { final int MAX = 10; int answer, guess; Scanner scan = new Scanner (System.in); Random generator = new Random(); // create a random number between 1 and MAX and store it in answer System.out.print ("I'm thinking of a number between 1 and " + MAX + ". Guess what it is: "); guess = scan.nextInt(); // complete the while loop so that the program will keep // asking the user to try again until the userExplanation / Answer
//please rate
package practicePackage;
//*******************************************************************
// Guessing.java
//
//*******************************************************************
import java.util.*;
public class Guessing {
//-----------------------------------------------------------------
// Plays a simple guessing game with the user.
//-----------------------------------------------------------------
public static void main (String[] args) {
final int MAX = 10;
int answer, guess;
Scanner scan = new Scanner (System.in);
Random generator = new Random();
// create a random number between 1 and MAX and store it in answer
answer=generator.nextInt(MAX)+1;
System.out.print ("I'm thinking of a number between 1 and " + MAX + ". Guess what it is: ");
guess = scan.nextInt();
// complete the while loop so that the program will keep
// asking the user to try again until the user
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.