Code a Java program to create the following game. This is a game of 4 questions (not
Question:
- Code a Java program to create the following game.
This is a game of 4 questions (not 20). The object of the gameis to determine what type of animal you are, (Rabbit, Dog, Fish orTurtle).
Inputs
Ask the player the following four yes/no questions and save theuser'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
You user could answer Yes, yes, or YES, so convert the answer tolowercase before you evaluate it.
Add 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.
Processing
You MUST use AND OR and NOT to completethis exercise. You MUST use thefollowing 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 areturtles 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
Phase 2
Write and execute at least one method. This method MUST bewritten by you (not a Java predefined method).
Add logic to allow the user to play the game again.
Validate that the user is entering only y/n or Y/N.
Phase 3
- Display an image of each animal when you figure out whichanimal it is