Question: Using JAVA code a program that is a 20 questions game. Below is an example of how the code should follow a decision tree: Coding

Using JAVA code a program that is a 20 questions game.

Below is an example of how the code should follow a decision tree:

Using JAVA code a program that is a 20 questions game. Below

Coding the program should follow below:

-Prompt the user with a message to "Think of a ___, press enter when ready " using a print statement.

-Then make the program pause before asking the first question.

-To do this we can simple call the scanner .next(); method that is basically asking for input for which the user will just hit enter and continue the program. This call should not save to any variable just a simple call. So for example if I had a Scanner object "input" simple type the code input.next();

-Next use a Scanner object ask questions that follow the logic of your decision tree. You'll need to use many nested if/else and if-else-if statements to do this

-Along the way make sure that String comparisons are NOT case sensitive when checking

-Here is an example of what this would look like if we only asked yeso questions.

is an example of how the code should follow a decision tree:

-Once your program comes to a conclusion about the user's object, it should print out the guess and prompt the user for confirmation if the guess was correct.

Coding the program should follow below: -Prompt the user with a message

-Based on the user's response to the question here, the game should either celebrate (if it guessed correctly) or lament (if incorrectly). Display an appropriate message to the user.

to "Think of a ___, press enter when ready " using a

The following is an example of a decision tree with yeso questions. More than 5 legs? (yeso): no Delicious? (yeso): YES Star of Charlotte's Web? (yeso): yes I guess that you are thinking of a pig! Did I guess it right? yes woo hoo!! I got it right \/

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!