Question: Create class Cat 2 . Add properties What characteristics do they have? Name, age, color, type ( domestic / feral ) , etc. ( secure
Create class Cat
Add properties
What characteristics do they have? Name, age, color, type domestic
feral etc. secure the data
What colors might they have? White, cream, fawn, Cinnamon,
Chocolate, Red, Lilac, Blue, Black, Lavender, etc.
Add methods: eat play etc.
Constructors?
A class provides a special type of methods, known as constructors,
which are invoked to construct objects from the class
Create different constructor with different initialization parameters
How to get the number of cats? Add a static variable and a static
method to print out the number of cats.
Test Cat class by creating Cat instances:
Each cat should have different properties.
Test all the methods.
Print out the number of cats.
To protect it from direct access and manipulation from
outside of the class we need to make our instance data
fields private.
To let clients still manipulate data under our control we
can provide them public getters and setters.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
