subject

Assignment: You are to create seven classes that represent a Zoo. The classes are define as follows:
1. Zoo
2. Enclosure
3. Animal
4. Crocodile
5. Gazelle
6. Lion
7. Zebra
1. Zoo:
Required member variables:
private String name;
private String address;
private Enclosure[] enclosures;
private int area;
private double budget;
2. Enclosure:
Required member variables:
private String biome;
private Animal[] animals;
3. Animal
Required member variables:
private String name;
private String genus;
private String species;
private Zoo currentZoo;
protected Animal enemy;
protected String prefferedBiome;
For classes 4-7, there are no required member variables.
All the classes must have getters and setters for each of their member variables. All of the classes must have overridden toString() and equals(...) functions. All classes must be in separate files. Crocodile, Gazelle, Lion and Zebra are Animals. Class Animal must implement this interface:
interface
Feedable
{
void
getFeedingInstructions();
void
feed();
}
All the child classes of Animal must have its own overridden
getFeedingInstructions();
and
feed();
functions.
The classes need to be implemented in a way that makes this main function:
public static void main(String[] args) {
//Creating a new Zoo.
Zoo laZoo = new Zoo("Los Angeles Zoo", "5333 Zoo Dr, Los Angeles, CA 90027", 133, 0);
//Creating two different Enclosures.
Enclosure firstEnclosure = new Enclosure("Savanna");
Enclosure secondEnclosure = new Enclosure("River");
//Creating our animals.
Zebra zeb = new Zebra("Zebby");
Gazelle gaz = new Gazelle("Gaz");
Crocodile croc = new Crocodile("Gena");
Lion leo = new Lion("Leo");
//Trying to add croc to the firstEnclosure, but Crocodiles can't live in the Savannah, so it prints an error message.
firstEnclosure. addAnimal(croc);
//Adding leo to the first enclosure.
firstEnclosure. addAnimal(leo);
//Adding croc to the second enclosure.
secondEnclosure. addAnimal(croc);
//Trying to add zeb to the secondEnclosure, but Crocodiles and Zebras are enemies, so it prints an error message.
secondEnclosure. addAnimal(zeb);
//Creating a new enclosure just for the herbivores.
Enclosure thirdEnclosure = new Enclosure("Savanna");
//Adding zeb and gaz to the third enclosure.
thirdEnclosure. addAnimal(zeb);
thirdEnclosure. addAnimal(gaz);
//Adding all three enclosures to the zoo.
laZoo. addEnclosure(firstEnclosure);
laZoo. addEnclosure(secondEnclosure);
laZoo. addEnclosure(thirdEnclosure);
//Printing the Zoo:
System. out. println(laZoo);
//Getting the feeding instructions for all the animals:
laZoo. getFeedingInstructions();
//Feeding the animals:
laZoo. feed();
//However, an error message is printed because the Zoo doesn't have enough money to feed all the animals,
so we add more money to the Zoo.
laZoo. setBudget(999999999);
//Successfully feeding the animals!
laZoo. feed();
}
Output this:
Error! Gena cannot live in the Savanna. addAnimal failed.
Error! Zebby cannot live with Gena, as they are enemies. addAnimal failed.
Los Angeles Zoo

Address: 5333 Zoo Dr, Los Angeles, CA 90027
Area: 133

Enclosures:
1. Savanna:
a) Leo (Panthera leo)
2. River:
a) Gena (Crocodylus niloticus)
3. Savanna:
a) Zebby (Equus quagga)
b) Gaz (Rhim gazelle)
How to Feed:
1. Savanna:
a) Meat 4000$
2. River:
a) Meat 5000$
3. Savanna:
a) Grass 600$
b) Grass 900$
Feeding failed! Out of funds.
Feeding completed successfully.
Submitting the assignment:
You must upload the assignment to canvas as a set of these 9 files in a
SINGLE
zip file called
last_first_Project2.zip
Main. java
Feedable. java
Zoo. java
Enclosure. java
Animal. java
Crocodile. java
Gazelle. java Lion. java
Zebra. java

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 18:30
If an improvement creates no significant change in a product’s performance, then it is a(n) ? a0 design improvement. (there are no answer choices)
Answers: 1
question
Computers and Technology, 23.06.2019 20:00
What software programs are used to to create professional publication? a.) graphics programs b.) word processors c.) page layout programs d.) spreadsheet programs
Answers: 2
question
Computers and Technology, 24.06.2019 14:00
What are the different components of the cloud architecture?
Answers: 2
question
Computers and Technology, 24.06.2019 16:30
Jenny needs to record the names of 30 students, write down the subjects they studied, and note their grades in each subject after the midsemester exams and the end-of-semester exams. she divides the midsemester and end-of-semester information into two separate worksheets, sheet 1 and sheet 2. how will she rename the two worksheets?
Answers: 2
You know the right answer?
Assignment: You are to create seven classes that represent a Zoo. The classes are define as follows...
Questions
question
SAT, 23.08.2021 18:00
question
Social Studies, 23.08.2021 18:00
question
Mathematics, 23.08.2021 18:00
question
Mathematics, 23.08.2021 18:00
Questions on the website: 13722360