PRG/421 Week 3 Java 3.17 LAB: Pet information (derived classes)

$ 6

PRG/421 Week 3 Lab 3.17 LAB: Pet information (derived classes)

The base class Pet has private fields petName, and petAge. The derived class Dog extends the Pet class and includes a private field for dogBreed. Complete main() to:
– create a generic pet and print information using printInfo().
– create a Dog pet, use printInfo() to print information, and add a statement to print the dog’s breed using the getBreed() method.

Ex. If the input is:
Dobby
2
Kreacher
3
German Schnauzer

The output is:
Pet Information:
Name: Dobby
Age: 2
Pet Information:
Name: Kreacher
Age: 3
Breed: German Schnauzer

995 in stock

SKU: PRG421WK3LAB3P17 Category:

Description

PRG/421 Week 3 Lab 3.17 LAB: Pet information (derived classes)

The base class Pet has private fields petName, and petAge. The derived class Dog extends the Pet class and includes a private field for dogBreed. Complete main() to:
– create a generic pet and print information using printInfo().
– create a Dog pet, use printInfo() to print information, and add a statement to print the dog’s breed using the getBreed() method.

Ex. If the input is:
Dobby
2
Kreacher
3
German Schnauzer

The output is:
Pet Information:
Name: Dobby
Age: 2
Pet Information:
Name: Kreacher
Age: 3
Breed: German Schnauzer

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.