Skip to main content

Practice · 2 of 4

Rectangle that validates

CHALLENGE
Difficulty: beginner+25 XP

Implement nested class Solution.Rectangle: constructor (double width, double height) throws ArgumentException unless both are positive; read-only Width/Height; Area(); Scale(double factor) grows **both** dimensions and throws ArgumentException for a non-positive factor.

Back to lesson: Practice: Class workout