Overview UML class diagrams are useful tools for mapping out different classes for an object-oriented program. The UML class diagram displays the attributes and methods of each class as well as...


Overview


UML class diagrams are useful tools for mapping out different classes for an object-oriented program. The UML class diagram displays the attributes and methods of each class as well as showing relationships between classes. In this activity, you will analyze a UML class diagram and implement either the Cat or the Dog class. The purpose of this activity is to give you practice interpreting a UML class diagram and implementing a class based on that diagram. Implementing classes based on a UML diagram is a valuable skill to help you work as a part of a development team. This assignment will also help prepare you to implement the Pet class as part of your Project One submission.


Prompt


For this assignment, you will select either the Cat or the Dog Java class from the UML diagram. Open the Virtual Lab (Apporto) by clicking on the link in the Virtual Lab Access module. Then open your Eclipse IDE and create a new class. Use theEclipse IDE Tutorial Videoif you need help with creating a class in Eclipse.



  1. Before you begin, review the following UML Class Diagram, paying special attention to the attributes and behaviors of each class. As a note, though the diagram illustrates an inheritance relationship between the classes, the class you choose to implement does
    not
    have to inherit from the Pet class for the purposes of this assignment. You will learn more about implementing inheritance in later modules.



This UML Class diagram shows three classes: Pet, Dog, and Cat. The Dog and Cat classes inherit from the Pet class. Each class is described below. The Pet class variables are petType, petName, petAge, dogSpaces, catSpaces, daysStay, and amountDue. All variables are private. The Pet class methods are getPetType, setPetType, getPetName, setPetName, getPetAge, setPetAge, getDogSpaces, setDogSpaces, getCatSpaces, setCatSpaces, getDaysStay, setDaysStay, getAmountDue, and setAmountDue. All methods are public. The Dog class variables are dogSpaceNumber, dogWeight, and grooming. All variables are private. The Dog class methods are getDogSpaceNumber, setDogSpaceNumber, getDogWeight, setDogWeight, getGrooming, and setGrooming. All methods are public. The only variable in the Cat class is catSpaceNumber, which is private. The methods are getCatSpaceNumber and setCatSpaceNumber. All methods are public.



  1. Next, you willimplementeitherthe Cat or Dog Java class. Your class must meet all of the specifications from the UML Class diagram. Be sure to include the following in your Cat or Dog class:


    • All attributes (variables) with appropriate data types. Note that the types are not specified in this UML class diagram. You will need to think about what the most appropriate data type is for each attribute.


    • At least one constructor method that initializes values for all attributes


    • Accessors and mutators for all attributes. Each attribute should have a corresponding accessor (“getter”) and mutator (“setter”) method. These methods are indicated in the class diagram.


    • In-line comments and appropriate white space, according to the style guidelines you have learned so far in the course




Guidelines for Submission


Submit your Cat or Dog class as a JAVA class file. Use theDownloading Files from Eclipse Tutorial PDFto help you download the file for your submission.

Jul 23, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here