Question: Question Java Q1/ In this assignment, I want you to design classes for a small number of classes. You will need to decide when you
Question
Java
Q1/ In this assignment, I want you to design classes for a small number of classes. You will need to decide when you will use inheritance and when you will use composition.
In your report:
For each class you come up with, tell me the following: Did you use composition or inheritance for the class? Why did you choose to use inheritance or composition for the class? Why did you add the data members that you did?
Write a java class for each of the classes. I am looking for you to name the classes and put in the data members for each class. Be sure to include visibility (public/private/protected) and the data type of each class.
The methods in your classes must be empty (no code). This is about designing classes, not writing code. You can also create UML diagrams (instead of Java classes).
Problem descriptions start:
A petting farm wants a program to help them keep track of where the animals are on a given day. The National Petting Farm Association has determined that petting farms get more visitors each year if the animals are moved to new enclosures every few days, so that the visitors get a sense of novelty. (A petting farm is like a zoo, except that visitors can touch the animals and feed them.)
You will design classes to keep track of which animals are in what enclosures at a petting farm. To simplify this assignment, we will assume that all enclosures are equivalent, and that any set of animals can be in any enclosure.
Here is some information that will help you decide how to design your classes:
An enclosure is a location where a group of animals will stay during the course of a day. An enclosure has a location code, a description of the enclosure, and is either empty or has a group of animals in it. The location code consists of three parts:
- The name of the area that the enclosure is in.
- A numerical ID for the enclosure.
- The ID of the zookeeper assigned to the enclosure.
A group of animals consists of a number of animals. Sometimes it is possible for a group to have different kinds of animals in a group, so don't count on a group of being the same kinds of animals. A group will have a name, a number of all animals in the group, and a description. The group will also have a veterinarian assigned to it.
An animal has an individual's name (such as Fred, Katy, Sport, etc), the kind of animal (such as zebra, kangaroo, lamb, goat, etc), a description, a birth date, vaccination date, and health status.
A zookeeper and veterinarian both have names and contact information. A zookeeper will have a specialty, and the veterinarian will have a specialty and after hours contact info.
End problem statement
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
