Question: (Java) Complete the code for the class Dog by writing the required methods. The instance variables are as given in the incomplete code shown below.

(Java) Complete the code for the class Dog by writing the required methods. The instance variables are as given in the incomplete code shown below. The requirements are stated under the code below.

(Java) Complete the code for the class Dog by writing the required

Requirements for the method findHumanYears : This method returns the dogs human years as an integer. This method takes in the instance variable, years, as the parameter. A human year is calculated as 7 times the (dog) years.

Requirements for the method findSize: This method returns the value of size as a string. This methods takes in the instance variable weight as a parameter. The size of the dog is calculated as follows: if weight is less than or equal to 20, the value of size is small or else, if the weight is less than or equal to 55, the size is medium, or else the size is large.

public class Dog private int weight: private int years: *Write the getters and setters for the instance variables/ variables /*Write the method findHumanYears/ /*Write the method findSize/

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!