Description
Sprint 1
In this sprint, you will build a basic data model similar to the previous two assignments.
Plan your work in Scrum.xlsx, and include your planning and status information at cse1325/P05/docs/.
In your git-managed cse1325 directory cse1325/P05/, with reference to the UML diagram below, create the
Java package shelter.
Remember, this means classes Animal, Shelter, and the two families of pets you choose (Dog and Cat are
shown below) are within package shelter at cse1325/P05/shelter/, with package shelter; at the top of
each file.
The Mass class and build.xml are outside the package at cse1325/P05/. In class Mass, you must either import
the classes from package shelter (for example, import shelter.Cat;) or use the fully qualified name
(new shelter.Cat()).
Always build (ant) and run (java Mass) from the cse1325/P05/ directory.
Write a very simple command line demonstrator program in class Mass for this sprint. This will be replaced
next sprint with a simple graphical user interface.
Add, commit, and push all files to your private cse1325 GitHub repository.
Hints
Animal
The Animal class is abstract, with methods family (optional) and breed as abstract methods.
Although this class is abstract, you will have a constructor (invoked from subclasses) to initialize its fields. The
constructor should also perform basic data validation and throw an exception for bad data. For example, if age
is negative, throw an IllegalArgumentException with an appropriate message.
You may include getters for the attributes if you need them, but not setters (at this time). Getters are not
shown on the class diagram.
Animal.toString may return whatever helps the subclasses with their toString.
DogBreed and Other Enumerations
You should have an enumerated list of breeds for each family of animal you use. Google is your friend.
Gender is also an enumeration.
Dog, Cat, Whatever
Your specific animal classes will extend Animal. Each constructor must collect data for the superclass via its
parameters and delegate to the Animal constructor before initializing the local fields.
Animal.family() must be overridden in each specific animal class to return a String representing that family, for
example, “dog” or “bird”. Alternately, you may use the instanceOf operator to determine the type of each
Animal.
The toString should return something like “Charlie (7 year old male dog)”, though the format is flexible as long
as all fields are displayed.
Shelter
This class models the shelter itself. The shelter has a name such as “Arlington Loves Animal Companions”
(ALAC), and also a list of all animals managed by the shelter (an ArrayList will work here). These should be
private, as we do not expect Shelter to act as a superclass.