Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

/ / public class Driver { / * * * main method * / public static void main ( String [ ] args ) {

//public class Driver {
/**
* main method
*/
public static void main(String[] args){
//1. Create a Farm of size 10
Farm farm = new Farm(10);
//2. Create 5 Animal Objects with the details specified in the table below
Animal a1= new Animal("cow",2012,1000.5,'f');
Animal a2= new Animal("pig",2009,550.5,'m');
Animal a3= new Animal("donkey",1999,773.42,'m');
Animal a4= new Animal("sheep",2016,164.23,'f');
Animal a5= new Animal("goose",2004,10.75,'f');
//3. Add the 5 Animal objects to the Farm
farm.addAnimal(a1);
farm.addAnimal(a2);
farm.addAnimal(a3);
farm.addAnimal(a4);
farm.addAnimal(a5);
//4. Call the printDetails method from the Farm to print all the Farm and Animal details.
farm.printAllDetails();
}
}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions