Question: Write a java class for a Dog with (1) an instance variable MyAge, (2) a constructor that takes in an int for the initial age

Write a java class for a Dog with (1) an instance variable MyAge, (2) a constructor that takes in an int for the initial age of Dog, (3) a method getOlder() to increment the age of the Dog, (4) a method toString () to return a string that say the Dog's age, and (5) a main method that creates a Dog object, called getOlder() and print the Dog.

Please code this in Jave please, Thanks

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!