Question: GuessingGame.java starting code: /* Programmer: Date: Project: Lab 3.3 GuessingGame File Name: GuessingGame.java Program Description: Simple guessing game where user guesses random number between 1
/* Programmer:
Date:
Project: Lab 3.3 GuessingGame
File Name: GuessingGame.java
Program Description: Simple guessing game where user guesses random number between 1 and 25.
*/
import java.util.*;
public class GuessingGame{
public static void main( String[] args ){
// cut and paste the line below in the methods as needed
Scanner keyboard = new Scanner(System.in);
// enter your code here
}
}
In this lab you will implement a game in which the user tries to guess a randomly generated integer. The user will have up to three guesses to correctly identify the random integer Name your program GuessingGame.java and meet all the descriptions below . Generate a random integer between 1 and 15, inclusive. Keep the number hidden from the user 2. Initialize a counter that keeps track of what guess the user is on. 3. Create a loop to complete the following steps while the userl has guesses a. Receive a guess from the user b. Determine if the guess is correct c. Display a message about their guess If they guess correctly: Tell the user how many guesses he/she used before correctly guessing the integer If they guess incorrectly Tell the user a helpful message like TOO HIGH" or TOO LOW" if they still have gucsses remaining. Tell the user the random integer (do not display ..TOO HIGH" or ..TOO LOW") if they are out of guesses. Hint: you can break out of a loop using the break keyword. For example the code below stops the loop when x-2 and 2 wl be printed to the screen. int x-1 while (x
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
