CJCoding With Joseph
15free / daySign inCreate account

Rectangle Area Class

Create a class named Rectangle that stores a width and a height in two integer fields. Give it a constructor that takes width and height (in that order) and saves them into the fields. Then add a method called Area() that returns the rectangle's area (width multiplied by height). The runner code will create a Rectangle and print the result of Area().

Expected Output:

20

= newline. The output ends with a newline — print one after the last line.

Hints4 available
Topics:
Classes
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · 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.