Question: This is for java programming. Please answer all the parts for number 8 only and explain well so that I may understand. Thank you. In

This is for java programming. Please answer all the parts for number 8 only and explain well so that I may understand. Thank you.

This is for java programming. Please answer all the parts for number8 only and explain well so that I may understand. Thank you.

In the loop example below tick() is used since the method relates to the virtual passing of time. While in this case all that happens is the hunger level increases other simulators might have much more complex effects. public static void main(String[] args) { ArrayList farm = new ArrayList(); for (Animal animal: farm) { animal.tick(); animal.feed(); System.out.println(animal.speak()); System.out.println(animal); 7. When printed an animal should indicate. The animal's name, the type of the animal and the animal's hunger level: Ely the cow is very hungry. 8. If we are never going to instantiate an Animal directly what type of class could we make it? Explain. Put your answer in the comments at the bottom of your report. Note: It is possible that when you run the simulation it will loop infinitely*. Can you explain why? Put your answer in the comments at the bottom of your report * For larger sets of animals this would almost always happen. You could put this in the constructor: hungerUnits = hungerUnits-(hungerUnits%5); What does this do? Why does this stop infinite loops? In the loop example below tick() is used since the method relates to the virtual passing of time. While in this case all that happens is the hunger level increases other simulators might have much more complex effects. public static void main(String[] args) { ArrayList farm = new ArrayList(); for (Animal animal: farm) { animal.tick(); animal.feed(); System.out.println(animal.speak()); System.out.println(animal); 7. When printed an animal should indicate. The animal's name, the type of the animal and the animal's hunger level: Ely the cow is very hungry. 8. If we are never going to instantiate an Animal directly what type of class could we make it? Explain. Put your answer in the comments at the bottom of your report. Note: It is possible that when you run the simulation it will loop infinitely*. Can you explain why? Put your answer in the comments at the bottom of your report * For larger sets of animals this would almost always happen. You could put this in the constructor: hungerUnits = hungerUnits-(hungerUnits%5); What does this do? Why does this stop infinite loops

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!