Lab 10
User Defined Java Classes
Objectives: Design and test a user-defined Java class
1. Design a user-defined Java class named Cat (or Dog).
a. The class must have at least 4 properties. The properties must NOT all be the same data type (e.g. name, lives, etc.).
b. List the class capabilities: accessors, mutators, constructor, and toString. There must be an accessor and mutator for each property.
c. Make a UML diagram for your class.
2. Create a constructor with a parameter list equal to the property list. Use the parameters to initialize all the properties.
3. Implement a toString method to display all the properties.
4. Write a separate class (TestCat or TestDog) to test all the class capabilities (all methods).
5. Copy the main method from the TestCat or TestDog class into the Cat or Dog class. Change the main method in the TestCat or TestDog class to have just one program statement (remove all other statements).
Cat.main(null);
6. Submit your completed program to Harvey Blackboard along with your UML diagram.
Repeat the above (but skip step 5) by designing a class for a storage box.