Question
In C# please This week well write a Guess Who game. The game works like this: The player is sent into room 1. In that
In C# please
This week well write a Guess Who game. The game works like this: The player is sent into room 1. In that room there is a popular character from a movie/TV show. The character introduces themselves and tells the player a little about themselves The player can either guess their name, or ask them for a hint. If they ask for a hint, the character will tell them a secret, then the player must guess their name. If they guess the character's name, they are told if they are correct or wrong, and sent to the next room either way. Play continues for 3 rooms, each has a different character in it. Tasks: Import (or copy/paste) the following interface into your IDE. Note, you cannot change this file:
interface ISpeak { string greeting(); string getInformation(); string sayGoodbye(); } abstract class Character : ISpeak{ private string description=null; private string whoami=null; public Character(string d, string w) { description=d; whoami=w; } public string getDescription() { return description; } public bool guessWho(string guess) { string lowerGuess=guess.ToLower(); string rightAns=whoami.ToLower(); return(lowerGuess.Equals(rightAns)); } public string getCharacterName() { return whoami; } public abstract string greeting(); public abstract string getInformation(); public abstract string sayGoodbye(); } using System; class Room { static int nextRoomNum=1; int roomNum; Character personInRoom; public Room() { roomNum=nextRoomNum++; if(roomNum==1) { personInRoom=new CharacterOne(); } else if(roomNum==2) { personInRoom=new CharacterTwo(); } else { personInRoom=new CharacterThree(); } Console.WriteLine("Welcome to room number "+roomNum); Console.WriteLine("In here we have a fascinating character from popular movies..."); Console.WriteLine("Movie character, please tell us a little about yourself..."); Console.WriteLine(); Console.WriteLine(" "+personInRoom.getDescription()); Console.WriteLine(" "+personInRoom.greeting()); Console.WriteLine(); } public void askForSecret() { Console.WriteLine("Okay, movie character, tell me a secret"); Console.WriteLine(); Console.WriteLine(" "+personInRoom.getInformation()); Console.WriteLine(); } public void sayGoodbye() { Console.WriteLine("Thank you "+personInRoom.getCharacterName()); Console.WriteLine(); Console.WriteLine(" "+personInRoom.sayGoodbye()); Console.WriteLine(); } public void guessWho(string nameGuess) { if(personInRoom.guessWho(nameGuess)) { Console.WriteLine("Congratulations you guessed "+nameGuess+" correctly."); Console.WriteLine(" "+personInRoom.getCharacterName()+" says "+personInRoom.sayGoodbye()); } else { Console.WriteLine("I'm sorry it's not "+nameGuess+" it was "+personInRoom.getCharacterName()); Console.WriteLine(" "+personInRoom.getCharacterName()+" says "+personInRoom.sayGoodbye()); } } } public static void Main (string[] args) { for(int i=0;i<3;i++) { Room newRoom=new Room(); Console.WriteLine("If you know who it is guess, if you don't type hint"); String theGuess=Console.ReadLine(); if(theGuess.Equals("hint")) { newRoom.askForSecret(); Console.WriteLine("OK, so who is it?"); String finalGuess=Console.ReadLine(); newRoom.guessWho(finalGuess); } else { newRoom.guessWho(theGuess); } } }
Based on the above code, you can see that there are 3 classes missing: CharacterOne CharacterTwo CharacterThree From the code you have above, you can tell what methods they should each have. Your job is to come up with three (3) famous characters, and implement CharacterOne as one of them, CharacterTwo as another, and CharacterThree as the third. They can be any character from movies/TV. Note you should NOT use the same characters shown in the sample output below, those are just examples of the code running. Example Runs: [User input in red] Welcome to room number 1 In here we have a fascinating character from popular movies... Movie character, please tell us a little about yourself... I'm a small, green creature with big ears Hello young one, hummm? If you know who it is guess, if you don't type hint hint Okay, movie character, tell me a secret A secret, hmmm? Well, let me think... Ah, here's one for you, young Padawan: the path to mastery, it is. Not just knowledge, hmmm? Not just power, no. But also, inner peace, balance and humility, it must include. So, remember this always, hmmm? OK, so who is it? Yoda Congratulations you guessed Yoda correctly. Yoda says Farewell, young one, hmmm? May the Force be with you, always. Welcome to room number 2 In here we have a fascinating character from popular movies... Movie character, please tell us a little about yourself... I'm a slow-witted but athletically-talented individual, who is loyal and trustworthy to those I care about. Hello there! Nice to meet ya! If you know who it is guess, if you don't type hint Forrest Gump Congratulations you guessed Forrest Gump correctly. Forrest Gump says Goodbye! It was nice talking to you, I hope we can chat again soon. Bye now! Welcome to room number 3 In here we have a fascinating character from popular movies... Movie character, please tell us a little about yourself... I'm known for my distinctive appearance, including my bald head and prominent scar, as well as his frequent use of catchphrases, such as "Throw me a frickin' bone here" Hello there, it's good to see you. Muahahahaha! If you know who it is guess, if you don't type hint hint Okay, movie character, tell me a secret Just between us, okay? Promise not to tell anyone... Here's a little something I learned from all my world domination attempts: always have a backup plan. You never know when the first one might fail, so always have a Plan B ready. That's my secret, and now it's yours. Muahahahaha! OK, so who is it? Harry Potter I'm sorry it's not Harry Potter it was Dr. Evil Dr. Evil says Goodbye, my friend. It's been a pleasure, as always. But now, I must go and continue my plans for world domination. Muahahahaha! Until we meet again...
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