Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Hi there, sorry for the length of the discription. I have to create a text-based

ID: 3621990 • Letter: H

Question

Hi there, sorry for the length of the discription.

 

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
as follows:
Name:gender:hairColor:eyeColor:hasGlasses:hasBeard:hasMustache:
For example, Margaret is female with white hair, blue eyes, glasses, and neither a beard nor a mustache,
so her line is as follows:
Margaret:female:white:blue:true:false:false:

 

PERSON
Create a new class called Person.
Fields:
•private String name
•private String gender
•private String eyeColor
•private String hairColor
•private boolean hasGlasses
•private boolean hasBeard
•private boolean hasMustache

 

Constructors:
• None.

 

Methods:
•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.

 

GUESSWHO
Create a new class called GuessWho.
Fields:
•private ArrayList people
•private Person mysteryPerson
•private Picture display
•private String guess

 

Constructors:
•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.

 

Methods:
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).

 

PLAYGUESSWHO
Create a new class called PlayGuessWho.
Methods:
public static void main(String [] args)
• This class will have only a main method. This main method will do the actual running of the
program.
• It will create a new instance of the GuessWho game, then print a “welcome” message to the
user.
• 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).

 

This link consists of GuessWho.txt, guessWho.jpg and Example run. Thank you in advance.

 

http://www.megaupload.com/?d=02KK4IM2 or http://www.filefactory.com/file/b46eb93/n/Dr.Java.rar

Explanation / Answer

I still dont have any idea how to display the image since it uses the Picture class which im guessing is some custom class that either the professor provides or you need to write. anyway, the program should work just fine. hopefully you can understand it. just make sure to add in the display part yourself. good luck since the files are kinda long, ill compress them and send you a link through PM

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote