The blanks are filled in, below.
The child class Food
extends the parent class.
It uses super
to use the parent's constructor and
the parent's toString()
method.
public class Food extends Goods { protected double calories; Food( String des, double pr, double cal) { super( des, pr ); calories = cal ; } public String toString() { return super.toString() + calories + " calories"; } }
(Review :) Would it be correct to reverse the order
of the statements in the constructor for Food
?