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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started