Question: 1 - Create a constructor in the Dog class that takes two input parameters and uses those parameters to initialize the instance variables. 2 -
Create a constructor in the Dog class that takes two input parameters and uses those parameters to initialize the instance variables.
In the main method inside the driver class, declare a variable of type Dog call it myDog and instantiate it with values of your choice.
In the main method inside the driver class, declare a variable of type Dog call it yourDog Instantiate it with appropriate values so that it represents a year old bulldog.
Add a getter for all of the variables of the dog class. Add a setter for all of the variables of the dog class.
When should your class have a getter for a variable? When should your class have a setter for a variable?
Create a toString method for your Dog class. What sentence will you use to describe the dog?
Add a static counter to the dog class. Create a variable to hold the dogs id
Update the constructors to use the static variable to assign a unique id to every dog that is created.
Add an equals method to the dog class. Two dogs should be considered equal if they have the same id
Suppose that x y and z are all Double objects. Describe all the boxing and unboxing that occurs in the assignment z x y
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
