Answered step by step
Verified Expert Solution
Link Copied!

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 play_game()
This method will first pick a random number between 0 and 100.
In java:
Add "import java.util.Random" at the top of this class
Random myRand = new Random();
myRand.nextInt(100);
In C#:
Random myRand = new Random(); myRand.Next(100);
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 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.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Time Series Databases New Ways To Store And Access Data

Authors: Ted Dunning, Ellen Friedman

1st Edition

1491914726, 978-1491914724

Students also viewed these Databases questions