Question: Java Programming. Design and implement a class called Dog that contains instance data that represents the dogs name and age (age can be an integer).

Java Programming.

Design and implement a class called Dog that contains instance data that represents the dogs name and age (age can be an integer). Define the Dog constructor to accept and initialize instance data. Include getter and setter methods for the name and age. Include a method to compute and return the age of the dog in person years (seven times the dogs age). Include a toString method that returns a one-line description (name and age) of the dog.

Create a driver class called Kennel, whose main method creates two dog objects with different names and ages. Print out the dogs descriptions (using the toString() method). Use the setter to rename the first dog and add one to the second dogs age. Print out both dogs age in person years (The age of dog-name in person years is ). Print out descriptions of both dogs again.

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!