Area of a 3x4 rectangle
Input
Rectangle(3, 4).area
Output
12
area computes width * height = 3 * 4 = 12
Full lesson preview
Implement a computed property that provides a read-only view derived from internal state.
Problem statement
Task
Examples
Input
Rectangle(3, 4).area
Output
12
area computes width * height = 3 * 4 = 12
Input format
Output format
Constraints
Samples
Input
Rectangle(2.5, 4).area
Output
10.0
Floating point width is supported; area is 2.5 * 4 = 10.0