Question: Need help writing in JAVA please. correct() Language English Spanish make_guess() Guess a number Adivina un numero too_low() too_high() Too Low Too High Demasiado bajo
Need help writing in JAVA please.





correct() Language English Spanish make_guess() Guess a number Adivina un numero too_low() too_high() Too Low Too High Demasiado bajo Demasiado alto Correct Correcto Trop haut Correct French Devinez un nombre Trop bas Simplified #18 Chinese All translations above are from google translate. TE Define a class called GuessNumber. o It must have a method called play_game() This method will first pick a random number between 0 and 100. In java: o Add "import java.util. Random" at the top of this class Random myRand = new Random(); o myRand.nextInt(100); In C#: o Random myRand = new Random(); o myRand.Next(100); Prompt the user to select a language to play in: Choose your language 1. English 2. Espaol 3. Franais 4. 1*** If the user selects English, using polymorphism, create a variable of type Language and instantiate an English object on it. If the user selects French, do the same with a variable of type Language with a new French object on it, etc... Using the object you created in the last step, prompt the user to enter their guess. If your object was called myLang, you should be able to just type: print(myLang.make_guess()); This will call the make_guess() method in the appropriate language that returns a string, which you can then print. Read in the user's guess. If it's too high, too low or correct, give them the appropriate prompt in the appropriate language. Driver Program: In your main method, simply make an instance of GuessNumber and call play_game() on it. Sample Output: Choose your language 1. English 2. Espaol 3. Franais 4. 160 1 Guess a number 50 Too High Guess a number 25 Too Low Guess a number 33 Too Low Guess a number 40 Too Low Guess a number 45 Too Low Guess a number 48 Too Low Guess a number 49 Correct [Separate run] Choose your language 1. English 2. Espaol 3. Franais 4. 4 50 75 85 80 77 76 Rubric: Language Class (15 points total) o Declared abstract (2 points) o 4 correctly declared abstract methods (make_guess, too_high, too_low, correct) (3 points each) English Class (15 points total) 4 correctly declared concrete methods (make_guess, too_high, too_low, correct) (3 points each) Each returns the appropriate string (2 points total) French Class (15 points total) 4 correctly declared concrete methods (make_guess, too_high, too_low, correct) (3 points each) Each returns the appropriate string (2 points total) Spanish Class (15 points total) 4 correctly declared concrete methods (make_guess, too_high, too_low, correct) (3 points each) Each returns the appropriate string (2 points total) Simplified Chinese Class (15 points total) 4 correctly declared concrete methods (make_guess, too_high, too_low, correct) (3 points each) Each returns the appropriate string (2 points total) GuessNumber Class (20 points total) o Successfully picks a random number (2 points) o Prints out the language choice menu and gets users choice (3 points) Uses if statements to instantiate correct language object (5 points) o Prompts user for guess in correct language (5 points) o Correctly tells the user if too high or low or correct (5 points) Main Class (5 points total) o Correctly instantiates Guess Number (3 points) o Correctly calls play_game() (2 points) Note: If a user has problems printing chinese characters due to character set issues, don't take off points for that. correct() Language English Spanish make_guess() Guess a number Adivina un numero too_low() too_high() Too Low Too High Demasiado bajo Demasiado alto Correct Correcto Trop haut Correct French Devinez un nombre Trop bas Simplified #18 Chinese All translations above are from google translate. TE Define a class called GuessNumber. o It must have a method called play_game() This method will first pick a random number between 0 and 100. In java: o Add "import java.util. Random" at the top of this class Random myRand = new Random(); o myRand.nextInt(100); In C#: o Random myRand = new Random(); o myRand.Next(100); Prompt the user to select a language to play in: Choose your language 1. English 2. Espaol 3. Franais 4. 1*** If the user selects English, using polymorphism, create a variable of type Language and instantiate an English object on it. If the user selects French, do the same with a variable of type Language with a new French object on it, etc... Using the object you created in the last step, prompt the user to enter their guess. If your object was called myLang, you should be able to just type: print(myLang.make_guess()); This will call the make_guess() method in the appropriate language that returns a string, which you can then print. Read in the user's guess. If it's too high, too low or correct, give them the appropriate prompt in the appropriate language. Driver Program: In your main method, simply make an instance of GuessNumber and call play_game() on it. Sample Output: Choose your language 1. English 2. Espaol 3. Franais 4. 160 1 Guess a number 50 Too High Guess a number 25 Too Low Guess a number 33 Too Low Guess a number 40 Too Low Guess a number 45 Too Low Guess a number 48 Too Low Guess a number 49 Correct [Separate run] Choose your language 1. English 2. Espaol 3. Franais 4. 4 50 75 85 80 77 76 Rubric: Language Class (15 points total) o Declared abstract (2 points) o 4 correctly declared abstract methods (make_guess, too_high, too_low, correct) (3 points each) English Class (15 points total) 4 correctly declared concrete methods (make_guess, too_high, too_low, correct) (3 points each) Each returns the appropriate string (2 points total) French Class (15 points total) 4 correctly declared concrete methods (make_guess, too_high, too_low, correct) (3 points each) Each returns the appropriate string (2 points total) Spanish Class (15 points total) 4 correctly declared concrete methods (make_guess, too_high, too_low, correct) (3 points each) Each returns the appropriate string (2 points total) Simplified Chinese Class (15 points total) 4 correctly declared concrete methods (make_guess, too_high, too_low, correct) (3 points each) Each returns the appropriate string (2 points total) GuessNumber Class (20 points total) o Successfully picks a random number (2 points) o Prints out the language choice menu and gets users choice (3 points) Uses if statements to instantiate correct language object (5 points) o Prompts user for guess in correct language (5 points) o Correctly tells the user if too high or low or correct (5 points) Main Class (5 points total) o Correctly instantiates Guess Number (3 points) o Correctly calls play_game() (2 points) Note: If a user has problems printing chinese characters due to character set issues, don't take off points for that
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
