ConceptParent Class, Child Class, or Interface?
Goods Parent Class
Food Child Class
Toy Child Class
Book Child Class
Taxable Interface

Picture of the Classes

various goods


Here is a picture that shows the classes and the interface. The children classes extend their parent. This is shown with a solid arrow pointing at the parent.

The solid arrows show inheritance. The three children inherit the display() method from their parent, Goods.

Two of the classes implement the interface. This is shown with a dotted arrow pointing at the interface.

The dotted arrows show what a class must implement. The Toy and Book classes must implement the calculateTax() method.


According to the picture,