Question: Create a class called Dog that represents a dog. The class should have fields representing the dog's name, age, and breed . Add two constructors

Create a class called Dog that represents a dog. The class should have fields representing the dog's name, age, andbreed. Add two constructors to the class: 1) a no parameter constructor that sets the following as default values -- name: Spot, age: 1, breed: retriever and 2) a constructor that takes parameters for each field. Your class should not contain any other fields or methods at this point.

Using your design and implementation of the above Dog class, add appropriate accessor and mutator methods to the class. (You do not have to retype the entire class, just type out the new methods requested.)

Write a toString() method that displays the information about a Dog object in a nice format (you get to decide the actual format).

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!