public class Cat {
//write your code here
private String name =null;
private int weight =1;
private int age = 2;
private String color = null;
private String address = null;
/*The class must have an initialize method that takes a name as an argument,
but initializes all variables except the address.*/
public void Initialize(String name){
this.name=name;
this.age=2;
this.weight=8;
this.color="grey";
}
/*The class must have an initialize method that takes a name,
weight, and age as arguments,
but initializes all variables except the address*/
public void Initialize(String name, int weight, int age){
this.name = name;
this.weight = weight;
this.age = age;
this.color = "green";
}
/*The class must have an initialize method
that takes a name and age as arguments,
and initializes all variables except the address.*/
public void Initialize(String name, int age){
this.name = name;
this.age = age;
this.weight = 3;
this.color = "marron";
}
/*
The class must have an initialize method that takes
a weight and color as arguments,
and initializes all variables except the name and address.
*/
public void Initialize(int weight, String color){
this.weight = weight;
this.color = color;
this.age = 4;
this.name = "Sushi";
}
/*
The class must have an initialize method that takes
a weight, color, and address as arguments,
but initializes all variables except the name.
*/
public void Initialize(int weight, String color, String address){
this.weight =weight;
this.color=color;
this.address=address;
this.age=5;
//this.name="Oscar";
}
public static void main(String[] args) {
System.out.println();
}
}
Please can anybody help me to understand where my mistake is?
Under discussion
Comments (1)
- Popular
- New
- Old
You must be signed in to leave a comment
Miki
17 September 2019, 13:32
i started to read from bottom of your code and pointed very soon where you have not followed instructions carefully. Hope this hint helps you :)
0