[ Team LiB ] Previous Section Next Section

Exercises

  1. Create a class called baseCalc() that stores two numbers as properties. Give it a calculate() method that prints the numbers to the browser.

  2. Create a class called addCalc() that inherits its functionality from baseCalc(). Override the calculate() method so that the sum of the properties is printed to the browser.

  3. Repeat activity 2 for a class called minusCalc(). Give minusCalc() a calculate method that subtracts the first property from the second, outputting the result to the browser.

    [ Team LiB ] Previous Section Next Section