This is my code and i am trying to pass the parameter from main to cat class but its saying no constructor cant figure out what to do a little help would be appreciated.
public class Cat extends Animal implements Pet {
public String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Cat(String name, int legs) {
super(4);
this.name = name;
}
public Cat() {
this("Fluppy"); //ERROR OVER HERE
}
@Override
public void play() { //THIS METHOD IS OVERRIDDEN FROM PET INTERFACE
System.out.println(name+"Likes to play with string");
}
@Override
public void eat() { /*THIS METHOD IS OVERRIDDEN FROM ANIMAL ABSTRACT METHOD.*/
System.out.println("Cats likes to eat spiders and fish");
}
}
and the main class
public class PetMain {
public static void main(String[] args) {
Animal a;
Pet p;
Cat c= new Cat("Tom"); //IM GETTING THE ERROR OVER HERE.
c.eat();
c.walk();
c.play();
}
}