CJCoding With Joseph

Sum Areas Through an Interface

The interface IShape declares double Area(). Complete Rectangle (area is width times height) and Square (area is side times side). The tester stores both in an IShape[] and adds up their areas. Do NOT write a Main method.

For a Rectangle(2, 3) and a Square(4) the total is 22, so the program prints:
22

Expected Output:

22
Topics:
Interfaces
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท Ctrl+Space to expand shortcuts (cw, cr, fori)

Your Output

Run your code to see the output here...

Test Cases

Run your code to see test case results.