Food
have?
display()
Toy
have?
display()
and calculateTax()
Here is a class definition for Goods
:
class Goods { String description; double price; Goods( String des, double pr ) { description = des; price = pr; } void display() { System.out.println( "item: " + description + " price: " + price ); } }
Here is a skeleton of the class Food
,
a child of Goods
.
It adds the variable calories
.