Java OOP GUIDE / WORK DOG CLASS Topics
TASK –
PART 1 – DOG CLASS Create
the structure of class named Dog that will represent a dog object. It has the following specification:
·
public
String breed – The breed of the dog. ·
public
String name – The dog’s name ·
public
int age – The dog’s age
·
public
void bark() – This method simply outputs “name is barking” on the screen. ·
public
void eat() – This method simply outputs “name
is eating” on the screen. ·
public
void sleep() – This method simply outputs “name is sleeping” on the screen. ·
public
void fetch() – This method simply outputs “name is fetching” on the screen. |
TASK – PART 2 – TESTING
THE DOG CLASS Create
another class called DogTester and follow the
following steps:
|