Answered You can hire a professional tutor to get the answer.

QUESTION

Java Programming Language Topic: Polymorphism Pprogram which allows the user to get information about a predefined set of animals. Three animals are...

| hsss

Your program should present the user with a prompt, ">", to indicate that the user can request. Your program accepts one request at a time from the user, prints out the answer to the request, and prints out a new prompt. Your program should continue in this loop forever. Every request from the user must be a single line containing 2 strings. The first string is the name of an animal, either "cow", "bird", or "snake". The second string is the name of the information requested about the animal, either "eat", "move", or "speak". Your program should process each request by printing out the requested data.

You will need a class to hold the information about each animal. Make a class called Animal which is containing three fields: food, locomotion, and noise, all of which are strings. Make three methods called Eat(), Move(), and Speak(). The Eat() method should print the animal's food, the Move() method should print the animal's locomotion, and the Speak() method should print the animal's spoken sound. Your program should call the appropriate method when the user makes a request.

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question