I'm working on a program for an intro to java class and am supposed to use the following interface:
public Interface Animal{
//The animal is first supposed to "speak" and then it gets to eat
//As long as the food supply lasts
public void feed();
//The animal eats
public void eat();
//The animal "talks"
public void talk();
//Print the name of the animal and then number of days
//that the food will still last.
public void print();
}
The assignment says that we're supposed to write an abstract class Pet that has object variables for the names of the animals as well as the food supply (given through a constructor) - but I'm confused at how to use object variables in a constructor to set the names and food supply. Can anyone help?