Complete the first four constructors of the following class. Each of the four constructors calls the fifth one by using the reserved word this.
class Cat {
private static final String DEFAULT_NAME = "No name";
private static final int DEFAULT_HGT = 6;
private static final double DEFAULT_WGT = 10.0;
private String name;
private int height;
private double weight;
public Cat( ) {
//assign defaults to all data members
}
public Cat(String name) {
//assign the passed name to the data member
//use defaults for height and weight
}
public Cat(String name, int height) {
//assign passed values to name and height
//use default for weight
}
public Cat(String name, double weight) {
//assign passed values to name and weight
//use default for height
}
public Cat(String name, int height, double weight){
this.name = name;
this.height = height;
this.weight = weight;
}
...
}
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.