Question: Write an interface for Animal. We will say that every Animal will make a sound and will be able to give it's type. Write a
Write an interface for Animal. We will say that every Animal will make a sound and will be able to give it's type. Write a class for Cow and a class for Chicken. The Cow's type can be "cow" and it's sound can be moo. The Chicken's type will be "chicken" and the sound will vary. About 50 percent of the time, the chicken will say "bawk!" and other times it will say "cluck".
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
