Need help programming a game like "Guess Who"
I have to create a text-based version of the popular Hasbro game Guess Who.
In this project you will write a program to play Guess Who using an ArrayList of Person objects to represent
the set of people and a Picture object to display the “board” of faces. You will create three classes called Person, GuessWho, and PlayGuessWho which will allow the user to play the game. When run, this program will display the image of the faces and ask the user to guess a feature or a name. After the user enters a guess, the GuessWho class will evaluate their guess and give them feedback on whether it matches the mystery person. This will repeat until the user successfully guesses who!
The Guess Who “faces” image mentioned is in the provided link. This is the image you should display when the user plays Guess Who.
A text file is also in the download link, describing the faces displayed in the image. You must
read in this file in and use the data to populate the “Person”s in the GuessWho game. The file is organized
For example, Margaret is female with white hair, blue eyes, glasses, and neither a beard nor a mustache,
so her line is as follows:
Create a new class called Person.
•private String name
•private String gender
•private String eyeColor
•private String hairColor
•private boolean hasGlasses
•private boolean hasBeard
•private boolean hasMustache
•Accessors for all fields
• Each field listed above should have an accessor method
• The name of each method must contain “get” and the field name
• No accessor method may take in a parameter
• Each method must have a return type matching the field it accesses
•Modifiers for all fields
• Each field listed above should have a modifier method
• The name of each method must contain “set” and the field name
• Each method may take in a parameter of the same type as the field it modifies
• Each method must have a return type of void
•public static Person parsePerson(String parseString, String delim)
• This method must parse the given parseString according to the given delim, and return a
new Person object. The method will utilize the modifiers in the Person class to set the features
of the Person object.
[NOTE: this method is static, indicating that it is a class method. Refer to section 3.3 in
the textbook for help.]
•public String toString()
• This method must return a String representation of this Person object. It should include the
person’s name, gender, and other features in a human-readable format.
Create a new class called GuessWho.
•private ArrayList people
•private Person mysteryPerson
•private Picture display
•private String guess
•public GuessWho(String fileName)
• This constructor should call a method below to read the given file into the people ArrayList.
• It must also call a method below to initialize the mysteryPerson field.
• It must also display the Guess Who faces image.
•public void playOneTurn()
• This method should print out a message to the user prompting them to input a feature or name.
• It should use a scanner to read in the user’s guess, save it to the appropriate field, and call the
checkGuess method. It should not handle more than one turn.
•public void checkGuess()
• This method will print out feedback to the user about their guess.
• This method should call the isOver method to determine if the user has won the game, printing
a message if this is the case.
• This method should check the user’s guess against the mystery person’s features, then print a
message whether they are correct or incorrect. If your method cannot determine what the user
is asking (ie: “zebra” is not a valid guess for anything), then print out a message saying their
guess is invalid. [See Example below for details on output]
•public boolean isOver()
• This method should check the user’s guess against the mysteryPerson‘s name, then return
true or false (whether the game is over, whether the user has guessed correctly).
•public Person pickMysteryPerson()
• This method will randomly select a Person object from the people ArrayList, and return it.
•public ArrayList readFromFile(String fileName)
• This method will open the given file for reading. It should read the file line by line.
• It will utilize the parsePerson method in Person.java to create a new Person object for
each line read in (passing the line to that class method).
Create a new class called PlayGuessWho.
•public static void main(String  args)
• This class will have only a main method. This main method will do the actual running of the
• It will create a new instance of the GuessWho game, then print a “welcome” message to the
• Within a loop, this method should call the above described playOneTurn() method to begin
play. The loop should end when that instance of the game isOver().
• Once the game is over, the name of the mystery person should be reveled (for full credit, you
must utilize the toString() method defined in the Person class).
The following is a the text within the GuessWho.txt file:
The following is a link to GuessWho.jpg and for Dr. Java:
MEGAUPLOAD - The leading online storage and file delivery service
Dr.Java.rar - download now for free. File sharing. Software file sharing. Free file hosting. File upload. FileFactory.com
Thank you very much for your help in advance