Best Answer - Chosen by Voters
Ok, so you can choose which 3 pets you want to create.
I will give you an example of 1 and let you do the other 2.
Let's say we have a cat.
What is something a cat can do? It can purr. So let's create a private variable to say if the cat is purring or not.
public class Cat extends Pet
{
private boolean purring;
// You need getter and setter methods for purring.
boolean getPurring()
// Although, since it is a boolean method, it should be written as
// boolean isPurring()
{
return purring;
}
void setPurring(boolean purr)
{
purring = purr;
}
// That is that out of the way.
// You need to overwrite the eat method
void eat()
{
if (getPurring())
// OR
// if (isPurring())
{
System.out.println("Purr, purr, purr");
}
System.out.println("Much, munch, munch"); // change this if you want.
if (getPurring())
// OR
// if (isPurring())
{
System.out.println("Purr, purr, purr");
}
// can you think of something that may happen since the cat has eaten?
// Hint: does it gain weight?
// Add something in here if you think you should.
}
}
That is the end of the cat class. Think of 2 other pets and do similar things.