Create a guessing game called Does It Have Legs?, in which you think of an animal and

Question:

Create a guessing game called “Does It Have Legs?”, in which you think of an animal and the computer tries to guess what it is. The game continually becomes “smarter” as you play because you teach it how to become more specific with its questions. For example, a typical game session might proceed as follows: 

Computer: Does the animal you are thinking of have legs?
Player: Yes.
Computer: Is it a dog?
Player: Yes.

Computer: Yay! I win. Do you want to play again?
Player: Yes.
Computer: Does the animal you are thinking of have legs?
Player: Yes.
Computer: Is it a dog?
Player: No.
Computer: I give up. What was your animal?
Player: Horse.
Computer: Type a question for which the answer is Yes for Dog but No for Horse.
Player: Does it live in the house?
Computer: Do you want to play again?
Player: Yes.
Computer: Does the animal you are thinking of have legs?
Player: Yes.
Computer: Does it live in the house?
Player: No.
Computer: Is it a Horse?
Player: No.
Computer: I give up. What was your animal?
Player: Cow.
Computer: Type a question for which the answer is Yes for Horse but No for Cow.
Player: Do people ride it?
Computer: Do you want to play again?
Player: Yes.
Computer: Does the animal you are thinking of have legs?
Player: Yes.
Computer: Does it live in the house?
Player: No.
Computer: Do people ride it?
Player: No.
Computer: Is it a Cow?

Player: Yes.
Computer: Yay! I win. Do you want to play again?
Player: No.

Save the application as DoesItHaveLegs.java.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question

Java Programming

ISBN: 978-1337397070

9th edition

Authors: Joyce Farrell

Question Posted: