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;
...
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here