Object-Oriented Programming In this separate files. ent, you'll need to build and run a small Zoo in Lennoxville. All classes must be created in Animal (5) First, start by building a class that describes an Animal at a Zoo. It should have one private instance variable for the name of the animal, and one for its hunger status (fed or hungry). Add methods for setting and getting the hunger satus variable, along with a getter for the name. Consider how these should be named for code clarity. For instance, using a method called hungry () to make the animal hungry could be used as a setter for the hunger field. The same logic could be applied to when it's being fed: public void feed () { this.fed = true; Furthermore, the getter for the fed variable could be named is Fed as it is more descriptive about what it answers when compared to get Fed. Keep this technique in mind for future class designs. Zoo (10) Now we have the animals designed and ready for building a little Zoo! Build a class called Zoo that contains an animal collection and a given address. Given that we'd like to increase the number of animals we have over time, we won't be able to use standard arrays. To have a dynamically-sized, resizable, or growable array, we will make use of the ArrayList class: https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/ArrayList.html To make a vector for the Animal collection, you can do the following: ArrayList animalCollection = new ArrayList(); animalCollection.add(new Animal ("Chloe the Bear")); Now let's get ready for some customers. Ensure that your Zoo can do the following: 1. Print opening hours for all Zoos (they all open and close at the same time 9AM-5PM). 2. Print the address of the Zoo. 3. Add an Animal to the Animal collection. 4. Feed, and set hunger for the Animals in the collection. 5. Print all Animals that are hungry in the Zoo. With all these methods implemented we are ready to open to the public! Pre-opening Day (5) You've realized that you should test your implementation before opening it the public! This means you will act as the first customer to the Zoos you are building, and perform at least the following in your main method: 1. Enter your Zoos (one is at "122 Queen St.", and the other at "248 College St."). 2. In the Zoo on Queen street, add these four Animals to the collection: a. Chloe the Bear b. Pete the Parrot 3. c. Sylvestre the Snake d. Manix the Monkey Leave the Zoo on College street empty. 4. Print the opening hours for the Zoos, and make sure they all match (i.e. not unique to instances). 5. Do the same for the addresses but this time they shouldn't match. 6. Feed "Chloe the Bear" at the Zoo on Queen St., and without it getting hungry again, try to feed it again. 7. Feed the same Animal at the Zoo on College St. 8. Print the Animals that are hungry at each Zoo. 9. Play with "Chloe the Bear" to make it hungry. 10. Re-print the Animals that are hungry. Competition (10) A competing zoo opened up next door on the same day as you. The Zoo has all the same features as yours currently has. Implement some feature(s) in your Zoo that will attract more people to yours! It should be created using 2 additional classes.

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter10: Introduction To Inheritance
Section: Chapter Questions
Problem 20RQ
icon
Related questions
Question
100%

Please include comments and docs comments on the program. 

 

The two other classes are Attraction and Entertainment. 

Object-Oriented Programming
In this
separate files.
ent, you'll need to build and run a small Zoo in Lennoxville. All classes must be created in
Animal (5)
First, start by building a class that describes an Animal at a Zoo. It should have one private instance
variable for the name of the animal, and one for its hunger status (fed or hungry).
Add methods for setting and getting the hunger satus variable, along with a getter for the name. Consider
how these should be named for code clarity. For instance, using a method called hungry () to make the
animal hungry could be used as a setter for the hunger field. The same logic could be applied to when it's
being fed:
public void feed () {
this.fed = true;
Furthermore, the getter for the fed variable could be named is Fed as it is more descriptive about what it
answers when compared to get Fed. Keep this technique in mind for future class designs.
Zoo (10)
Now we have the animals designed and ready for building a little Zoo!
Build a class called Zoo that contains an animal collection and a given address. Given that we'd like to
increase the number of animals we have over time, we won't be able to use standard arrays. To have a
dynamically-sized, resizable, or growable array, we will make use of the ArrayList class:
https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/ArrayList.html
To make a vector for the Animal collection, you can do the following:
ArrayList<Animal> animalCollection = new ArrayList<Animal>();
animalCollection.add(new Animal ("Chloe the Bear"));
Transcribed Image Text:Object-Oriented Programming In this separate files. ent, you'll need to build and run a small Zoo in Lennoxville. All classes must be created in Animal (5) First, start by building a class that describes an Animal at a Zoo. It should have one private instance variable for the name of the animal, and one for its hunger status (fed or hungry). Add methods for setting and getting the hunger satus variable, along with a getter for the name. Consider how these should be named for code clarity. For instance, using a method called hungry () to make the animal hungry could be used as a setter for the hunger field. The same logic could be applied to when it's being fed: public void feed () { this.fed = true; Furthermore, the getter for the fed variable could be named is Fed as it is more descriptive about what it answers when compared to get Fed. Keep this technique in mind for future class designs. Zoo (10) Now we have the animals designed and ready for building a little Zoo! Build a class called Zoo that contains an animal collection and a given address. Given that we'd like to increase the number of animals we have over time, we won't be able to use standard arrays. To have a dynamically-sized, resizable, or growable array, we will make use of the ArrayList class: https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/ArrayList.html To make a vector for the Animal collection, you can do the following: ArrayList<Animal> animalCollection = new ArrayList<Animal>(); animalCollection.add(new Animal ("Chloe the Bear"));
Now let's get ready for some customers. Ensure that your Zoo can do the following:
1. Print opening hours for all Zoos (they all open and close at the same time 9AM-5PM).
2.
Print the address of the Zoo.
3. Add an Animal to the Animal collection.
4. Feed, and set hunger for the Animals in the collection.
5. Print all Animals that are hungry in the Zoo.
With all these methods implemented we are ready to open to the public!
Pre-opening Day (5)
You've realized that you should test your implementation before opening it the public! This means you will
act as the first customer to the Zoos you are building, and perform at least the following in your main
method:
1.
Enter your Zoos (one is at "122 Queen St.", and the other at "248 College St.").
2.
In the Zoo on Queen street, add these four Animals to the collection:
a. Chloe the Bear
b.
Pete the Parrot
3.
c. Sylvestre the Snake
d. Manix the Monkey
Leave the Zoo on College street empty.
4. Print the opening hours for the Zoos, and make sure they all match (i.e. not unique to
instances).
5. Do the same for the addresses but this time they shouldn't match.
6. Feed "Chloe the Bear" at the Zoo on Queen St., and without it getting hungry again, try to
feed it again.
7. Feed the same Animal at the Zoo on College St.
8. Print the Animals that are hungry at each Zoo.
9. Play with "Chloe the Bear" to make it hungry.
10. Re-print the Animals that are hungry.
Competition (10)
A competing zoo opened up next door on the same day as you. The Zoo has all the same features as
yours currently has. Implement some feature(s) in your Zoo that will attract more people to yours! It
should be created using 2 additional classes.
Transcribed Image Text:Now let's get ready for some customers. Ensure that your Zoo can do the following: 1. Print opening hours for all Zoos (they all open and close at the same time 9AM-5PM). 2. Print the address of the Zoo. 3. Add an Animal to the Animal collection. 4. Feed, and set hunger for the Animals in the collection. 5. Print all Animals that are hungry in the Zoo. With all these methods implemented we are ready to open to the public! Pre-opening Day (5) You've realized that you should test your implementation before opening it the public! This means you will act as the first customer to the Zoos you are building, and perform at least the following in your main method: 1. Enter your Zoos (one is at "122 Queen St.", and the other at "248 College St."). 2. In the Zoo on Queen street, add these four Animals to the collection: a. Chloe the Bear b. Pete the Parrot 3. c. Sylvestre the Snake d. Manix the Monkey Leave the Zoo on College street empty. 4. Print the opening hours for the Zoos, and make sure they all match (i.e. not unique to instances). 5. Do the same for the addresses but this time they shouldn't match. 6. Feed "Chloe the Bear" at the Zoo on Queen St., and without it getting hungry again, try to feed it again. 7. Feed the same Animal at the Zoo on College St. 8. Print the Animals that are hungry at each Zoo. 9. Play with "Chloe the Bear" to make it hungry. 10. Re-print the Animals that are hungry. Competition (10) A competing zoo opened up next door on the same day as you. The Zoo has all the same features as yours currently has. Implement some feature(s) in your Zoo that will attract more people to yours! It should be created using 2 additional classes.
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Similar questions
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr