ITEC 120 LAB Quiz 5 (EC)

Inheritance

You will create a class called Pet and an inherited class called Dog.

Pet

# name: String
# age : int

+ toString():String

Dog

- breed: String
- treat : String

+ toString():String

In the Pet.java file:

In the Dog.java file:

Write a driver program which will instantiate one Pet object and two Dog objects. Make up data to pass to the constructors. Then print out each object you instantiated.

Submit the three files in your RU09 folder on Neelix.