Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need this in C# CSE1322L Assignment 4 Background: When you design a piece of software, you often don't consider that the users may not

I need this in C#

image text in transcribed

image text in transcribedimage text in transcribed

CSE1322L Assignment 4 Background: When you design a piece of software, you often don't consider that the users may not speak the same language you do. Companies who wish to ship their software to different countries will need to "internationalize their applications. Typically this is done by translating all strings used in the interface to the various languages. In this lab, you'll be writing a number guessing game. The game will pick a random number between 0 and 100. You'll prompt the user to enter their guess and you'll let them know if they guessed too high, too low, or if they guessed correctly. You'll allow them to keep guessing until they reach the correct answer. The game can be played in English, Spanish, French or Simplified Chinese. To avoid writing four different versions of this software, you will leverage OOP and Polymorphism to provide the strings from each language. You'll start with a language class. It will have abstract methods for every possible string you may use in your interface. Then you'll create English, Spanish, French and Simplified Chinese classes which will override the abstract class' methods and return the appropriate string. Classes you must create: . Define an abstract Language class It should have 4 abstract methods all of which should return a string: o make_guess() too_low() o too_high() o correct() Define a class called English which inherits from Language. Define a class called Spanish which inherits from Language. Define a class called French which inherits from Language. Define a class called Simplified Chinese which inherits from Language. Each class will need to override all 4 inherited methods and each should return a string as per the table on the next page. Hint: You'll probably want to copy and paste the strings from each language: o Language make_guess() too_low() too_high() correct() English Guess a number Too Low Too High Correct Spanish Adivina un numero Demasiado bajo Demasiado alto Correcto French Devinez un nombre Trop bas Trop haut Correct TE Simplified XE Chinese * All translations above are from google translate. 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: o Add "import java.util. Random" at the top of this class Random myRand = new Random(); o myRand.nextInt(100); In C#: 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. 164#* 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. 16#* 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 CSE1322L Assignment 4 Background: When you design a piece of software, you often don't consider that the users may not speak the same language you do. Companies who wish to ship their software to different countries will need to "internationalize their applications. Typically this is done by translating all strings used in the interface to the various languages. In this lab, you'll be writing a number guessing game. The game will pick a random number between 0 and 100. You'll prompt the user to enter their guess and you'll let them know if they guessed too high, too low, or if they guessed correctly. You'll allow them to keep guessing until they reach the correct answer. The game can be played in English, Spanish, French or Simplified Chinese. To avoid writing four different versions of this software, you will leverage OOP and Polymorphism to provide the strings from each language. You'll start with a language class. It will have abstract methods for every possible string you may use in your interface. Then you'll create English, Spanish, French and Simplified Chinese classes which will override the abstract class' methods and return the appropriate string. Classes you must create: . Define an abstract Language class It should have 4 abstract methods all of which should return a string: o make_guess() too_low() o too_high() o correct() Define a class called English which inherits from Language. Define a class called Spanish which inherits from Language. Define a class called French which inherits from Language. Define a class called Simplified Chinese which inherits from Language. Each class will need to override all 4 inherited methods and each should return a string as per the table on the next page. Hint: You'll probably want to copy and paste the strings from each language: o Language make_guess() too_low() too_high() correct() English Guess a number Too Low Too High Correct Spanish Adivina un numero Demasiado bajo Demasiado alto Correcto French Devinez un nombre Trop bas Trop haut Correct TE Simplified XE Chinese * All translations above are from google translate. 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: o Add "import java.util. Random" at the top of this class Random myRand = new Random(); o myRand.nextInt(100); In C#: 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. 164#* 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. 16#* 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

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

More Books

Students also viewed these Databases questions

Question

List the components of the strategic management process. page 72

Answered: 1 week ago