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.
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
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