Exercises
Create a class called baseCalc() that stores two numbers as properties. Give it a calculate() method that prints the numbers to the browser. 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. 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.
|