Question: Identify the key parts of the Java Class below. Put asterisks next to all the instance variables. Place a box around each constructor. Circle the

Identify the key parts of the Java Class below. Put asterisks next to all the instance variables. Place a box around each constructor. Circle the signature of methods other than the constructor method. Place triangles around the parameters. Underline the return types of methods.

public class Animal {

int weight, height;

double speed;

Animal() {

weight = 50;

height = 4;

speed = 2; //miles per hour

}

Animal(int w, int h, int s ) {

weight = w;

h = height;

speed = s

}

public double getTime(double miles) { //gets the number of hours to go these miles

return miles/speed;

}

public int getWeight() {

return weight;

}

public int getHeight() {

return height;

}

public double getSpeed() {

return speed;

}

}

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!