Need Help ?
Have a Question ?

(Solved): Code A Java Program To Create The Following Game. This Is A Game Of 4 Questions (not 20). The Object ...

Code a Java program to create the following game.

This is a game of 4 questions (not 20). The object of the game is to determine what type of animal you are, (Rabbit, Dog, Fish or Turtle).

Ask the player the following four yes/no questions and save the user's answers in variables.

  • Do you swim? yes - no ·
  • Do you have fins? yes - no ·
  • Do you bark? yes - no ·
  • Do you growl? yes - no

Use confirm Dialog Boxes to get the yes/no answers from the user.

Add a loop to continue playing the game.

Stop when the user wants to stop.

Count how many times the user played the game.

Use the abbreviated incrementor to do this.


You MUST use AND OR and NOT to complete this exercise. You MUST use the following assumptions to determine the animal.

• Animals that swim AND have fins are fish
• Animals that can bark OR growl are dogs
• Animals that do NOT swim are rabbits
• Animals that swim but do NOT have fins AND do NOT bark are turtles Outputs

When you figure out what animal it is, have the animal say "Oh, that is me. I am a .............."

At the end, output Programmed by: your name

Comment your code, as always.

Phase 2 - Required

Write and execute at least one method. This method MUST be written by you (not a Java predefined method).

Add logic to allow the user to play the game again.

Count the number of times the user has played the game.

Phase 3 - Required - Research Challenge

  • Display an image of each animal when you figure out which animal it is.
  • Use the following names for your image files
    • rabbit.jpg
    • fish.jpg
    • dog.jpg
    • turtle.jpg

Sample Run

Welcome to What Animal am I ?.

Do you swim? yes/no YES

Do you have fins? yes/no YES

Do you bark? yes/no NO

Do you growl? yes/no NO

------------------------------- Ahhh, I see, you are FISH

Do you want to play again? Yes/no NO

You played the game 1 time.

Thanks for playing.

Expert Answer

before running code you need to keep 4 files in your current program directory. download any four images of animals and rename then as rabbit.jpeg, fish.jpeg, turtle.jpeg, dog.jpeg Now create file nam
We have an Answer from Expert Buy This Answer $6