Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Mav's Animal Shelter Software Due Tuesday, March 1 at 8 a.m. CSE 1325 - Spring 2022 - Homework #5 - Sprint 1 - Revision
Mav's Animal Shelter Software Due Tuesday, March 1 at 8 a.m. CSE 1325 - Spring 2022 - Homework #5 - Sprint 1 - Revision 0 - 1 Assignment Background This begins our class project for the semester. We intend to host 5 1-week sprints, each ending (logically enough) at 8 am on Tuesdays. This semester we will be developing the Mavs Animal Shelter Software (MASS), which manages a no-kill shelter aiming to help companion animals of various types to adopt humans. Yes, I have a soft spot for warm fuzzies. We need to keep track of the animals at our shelter, the human candidates for the animals to adopt, and the animal - candidate matches made in heaven. You are encouraged to replace Dog and Cat with other families of animals such as guinea pigs, tarantulas, snakes, lizards, or parrots. different class hierarchy, with the user interface at root and the data model in For the project, we will use package shelter. 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. Mass +mainlargs Strinall shelter Shelter -name: String -animals ArrayList Animal +Shelterineme: Stringl +addAnimaKanimal: Animal +tString String Dog neme: String gender: Gender age int Animal +Animelineme: String, pender: Gender, age: inti +String family: +String breed +toStringil: String breed: Dagbreed +Dogibreed Degreed, name: String gender: Gender, agent) +String family +String breedil: +tostringll: String DogBreed add your breeds here Gender male female Cat -breed: Cet reed +Catbreed: Calfireed name: String, pender: Gender, age inti +String family +String breedil: +teStringo: String CatBreed add your breeds here 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. Dog Breed 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 instance Of 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. Method addAnimal simply appends its parameter to animals. Until we get to iterators, use the numAnimals method to return how many animals the shelter is managing, and getAnimal(int index) to obtain a reference to a specific animal. You may NOT provide a getter for the ArrayList itself - that implementation detail may change! Method toString should return each animal's toString separated by newlines. Mass Write a main method that demonstrates your shelter package using the console (System.out or System.console()). Instance at least one of each of your family of animals, add them to the list, then print the animals in the shelter.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started