Taxable Interface

Classic programmed-learning exercises, refreshed for modern Java and presented in the current MrStyner.com portfolio style.

Modern Java noteThis archive has been refreshed for Java 25 LTS. Core language concepts remain useful, while outdated setup instructions and browser-era Java are labeled or replaced. Java 26 is the current feature release; Java 25 is used here as the stable teaching baseline.

Answer:

No. The super must come first.

Taxable Interface

Here is Taxable:

  • A Taxable item,
    • has a taxRate of 6 percent, which should be a double constant.
    • and a calculateTax() method. which should return a double value.

The Taxable interface looks like this:

interface Taxable
{
  final double  =  ;
  double () ;
}

final means that what follows is a constant, not a variable. Variables are not allowed in interfaces. In fact, the final can be omitted since the compiler will automatically make the identifier a constant. The = value part cannot be omitted.

The method declaration (in the second line) is public by default.

QUESTION 10:

Fill in the blanks.