Adding another Class
Since taxRate is a constant, it must be set to a value,
here, 6 percent.
interface Taxable
{
final double taxRate = 0.06 ;
double calculateTax() ;
}
|
Here is a partial definition of Toy.
Recall that it:
- Has a parent Goods.
- Adds a variable minimumAge.
- Is taxable.
class Toy extends Goods ____________ ____________
{
int minimumAge;
Toy( String des, double pr, int min)
{
super( des, pr );
minimumAge = min ;
}
void display()
{
super.display() ;
System.out.println( "minimum age: " + minimumAge );
}
public double ____________() // implementing the interface
{
return price * ____________ ;
}
}
|
|