Question: Create class Cat 2 . Add properties What characteristics do they have? Name, age, color, type ( domestic / feral ) , etc. ( secure

Create class Cat
2. Add properties
What characteristics do they have? Name, age, color, type (domestic /
feral), etc. (secure the data)
What color(s) might they have? White, cream, fawn, Cinnamon,
Chocolate, Red, Lilac, Blue, Black, Lavender, etc.
3. Add methods: eat(), play(), etc.
4. Constructors?
A class provides a special type of methods, known as constructors,
which are invoked to construct objects from the class
Create 2 different constructor with different initialization parameters
5. How to get the number of cats? Add a static variable and a static
method to print out the number of cats.
6. Test Cat class by creating 3 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 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 Databases Questions!