Answered step by step
Verified Expert Solution
Question
1 Approved Answer
A UML diagram in DIA would be much appreciated. Assignment 3 tests your basic knowledge of classes and objects (Chapter 3). Design a class called
A UML diagram in DIA would be much appreciated.
Assignment 3 tests your basic knowledge of classes and objects (Chapter 3).
Design a class called YourNamePet (the class file should be called YourNamePet.java; replace YourName with your actual name), with the following exact1 fields:
Field Description
name This field holds the name of the pet
type This field holds the type of animal that the pet is age This field holds the age of the pet (in years) weight This field holds the weight of the pet
color This field holds the color of the pet
Example of values
Spot, Fluffy
dog, cat, bird, fish, rabbit, turtle 1, 9
16.5, 3.0
orange, brown
The YourNamePet class should also have the following exact2 (name and functionality) methods:
Method
setName getName setType getType setAge getAge setWeight getWeight setColor getColor
Description
This method stores a value in the name field This method returns the value of the name field This method stores a value in the type field
This method returns the value of the type field This method stores a value in the age field
This method returns the value of the age field This method stores a value in the weight field This method returns the value of the weight field This method stores a value in the color field
This method returns the value of the color field
Once you have designed the class, design a program/project/driver class (the program/project/driver class file should be called Assignment3.java; replace YourName with your actual name) that creates an object of the Pet class and prompt the user to enter (in a descriptive/user-friendly way3) the name, type, age, sound, weight, and color, of his or her pet. This data should be stored in the object using the corresponding Set methods. Use the objects accessor Get methods to retrieve the data from the object (the pets name, type, age, weight, and color) and confirm them by printing them out. You will need to add the class YourNamePet to the YourNameAssignmen3 project and add
your code to the project/driver class main method.
Create the UML diagram for the 2 classes using either Dia or Microsoft Word ad add it to a Microsoft Word document
called YourNameAssignment3-UML.docx. If you use Dia, please paste a screenshot of your diagram in the document.
Create a Microsoft Word document called YourNameAssignment3-Screenshots.docx (replace YourName with your actual name) that contains screenshots of the editor window showing the entire JAVA source code for both YourNameAssignment3 and YourNamePet classes and the entire output. If the entire class JAVA source code or the output does not fit in one screenshot or the screenshots cannot be easily read, create multiple screenshots and add multiple screenshots to the screenshot document.
Submit YourNameAssignment3.java, YourNamePet.java, YourNameAssignment3-UML.docx, and YourNameAssignment3-Screenshots.docx on eCampus under the Assignment 3. Do not archive the files (e.g. no RAR, ZIP, etc.) or submit other types/formats of files (e.g. no CLASS, PDF, etc.).
Follow the Assignment Code Convention.
1 Use the exact names (spelling, caps). You are not going to earn any credit if the classes do not contain your actual name and the fields do not have the exact/precise names.
2 Use the exact names (spelling, caps). You are not going to earn any credit if the classes do not contain your actual name and the methods do not have the exact/precise names and functionality.
3 For example, a message like Please enter the age of your pet or Please enter an integral number representing the age of your pet: would allow the user to know what they should enter in a user-friendly way.
A UML diagram using DIA would be much appreciated.
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