Question: Problem 2-Write methods Submit a program called: GuessingGame.java DO NOT MODIFY MAIN. NO CREDIT FOR THE PROGRAM IF MAIN IS MODIFIED public class GuessingGame /*Create

 Problem 2-Write methods Submit a program called: GuessingGame.java DO NOT MODIFY

Problem 2-Write methods Submit a program called: GuessingGame.java DO NOT MODIFY MAIN. NO CREDIT FOR THE PROGRAM IF MAIN IS MODIFIED public class GuessingGame /*Create a method called numGenerate) that randomly generates a number to guess. This method takes an int parameter that serves as a bound (meaning the randomly generated number should not be larger than this bound) and returns the randomly generated number*/ /*Create a method called getUserlnput(). This method should take a String message that serves as a prompt for the user. The method should return an int that was input by the user /*Create a method called compareGuess). This method should take two int parameters- one should be the user's guess and the other should be the number thle user is trying to guess. The method should return a boolean depending on whether or not the user's guess matches the goal number to be guessed. /*Create a method called finalMessage(). This method should take a boolean and an int parameter (this int parameter should represent the number to be guessed). The method simply prints out whether the user won or lost the game and states what the goal number was after. Hint: the boolean parameter determines whether or not the game was won. public static void main (String [args) //DO NOT MODIFY System.out.println("Welcome to the guessing game!"); System.out.println(" You have 3 guesses!"); int n=getUserinput("Enter the largest number possible to guess (remember, if you want 5 to be the largest enter one larger-6)"); int numToGuess-numGenerate(n); int i-0 boolean choice-true while(i

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!