Question: Java Create an enum type with a constructor and explicit instance fields and accessors for those fields. Name it AnimalHunger with four constants (dog, cat,
Java
Create an enum type with a constructor and explicit instance fields and accessors for those fields.
Name it AnimalHunger with four constants (dog, cat, rabbit, bear).
Each AnimalHunger constant takes one value - the average pounds of food an adult of that kind of animal is expected to eat each day.
Create a program to test your enum type
- The loop portion will allow the keeper to choose:
- select an animal, then enter the average amount of food that animal will eat in a day.
- print out a single animal along with the average amount of food they eat in a day.
- print out all the animals in a chart with the average amount of food they eat in a day.
Test program must loop until the user wants to quit.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
