Question: Write a UML diagram for a Cat class. Your cat has 3 attributes: name (i.e. Tobey) which is a String breed which is the type

Write a UML diagram for a Cat class. 


Your cat has 3 attributes:

  • name (i.e. Tobey) which is a String
  • breed which is the type of cat it is (i. e. Himalayan Sealpoint), also a String
  • gender which is a char (M is for Male, F is for female)
  • age which is an int (i.e. 2)


Make sure you write the class name in the top box, the private data members in the second box, and the constructors along with the getters and setters in the last box. For the constructor, pass in the name, breed and gender as parameters. Make sure you have all the correct notation for the UML diagram. If you are having trouble, look at the rectangle example in the power point slides from Chapter 3.



UML Class Diagram for Cat
















Step by Step Solution

3.46 Rating (156 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Please find the below Cat and CatDemo classes CatDemo class has the main method to test the Cat clas... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!