Answered step by step
Verified Expert Solution
Question
1 Approved Answer
java please Define a class called GuessNumber. It must have a method called play _ game ( ) This method will first pick a random
java please
Define a class called GuessNumber.
It must have a method called playgame
This method will first pick a random number between and
In java:
Add "import java.util.Random" at the top of this class
Random myRand new Random;
myRand.nextInt;
In C#:
Random myRand new Random; myRand.Next;
Prompt the user to select a language to play in:
Choosyour language
English
Espaol
Franais
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:
This will call the makeguess 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 playgame on it
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