what have i missed ?
package com.codegym.task.task05.task0517;
/*
Creating cats
Create the Cat class with five constructors:
- Name,
- Name, weight, age
- Name, age (standard weight)
- Weight, color (name, address, and age are unknown; the cat is homeless)
- Weight, color, address (someone else's pet)
The constructor's job is to make the object valid.
For example, if the weight is unknown, then you need to specify some average weight.
A cat can't weigh nothing.
The same applies to age. But there may or may not be a name (i.e. name might be null).
The same applies to the address (it might be null).
Requirements:
6. The class must have a constructor that takes a name as an argument, but initializes all variables except the address.
7. The class must have a constructor that takes a name, weight, and age as arguments, and initializes all variables except the address.
8. The class must have a constructor that takes a name and age as arguments, and initializes all variables except the address.
9. The class must have a constructor that takes a weight and color as arguments, and initializes all variables except the name and address.
10. The class must have a constructor that takes a weight, color, and address as arguments, and initializes all variables except the name.
*/
public class Cat {
//write your code here
String name="aaaaaa";
int age=1;
int weight=10;
String color="aaa";
String address;
public Cat (String name)
{
this.name=name;
this.age=age;
this.weight= weight;
this.color= color;
}
public Cat (String name ,int weight,int age)
{
this.name=name;
this.age=age;
this.weight= weight;
this.color= color;
}
public Cat (int weight, String color)
{
this.age=age;
this.weight= weight;
this.color= color;
}
public Cat (int weight,String color,String address)
{
this.age=age;
this.weight= weight;
this.color= color;
this.address=address;
}
public static void main(String[] args) {
Cat c1 = new Cat("aaaa");
Cat c3 = new Cat("aaaa",10,3);
Cat c2 = new Cat( 2,"aaaaa");
Cat c4 = new Cat(2, "aaaa");
Cat c5 = new Cat(2,"blue","aaaa");
}
}