โ Back to Interfaces
Question 612
Sum Areas Through an Interface
Sum Areas Through an Interface
The interfaceIShapedeclaresdouble Area(). CompleteRectangle(area is width times height) andSquare(area is side times side). The tester stores both in anIShape[]and adds up their areas. Do NOT write aMainmethod. For aRectangle(2, 3)and aSquare(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.