Shape Shop (Enums)
Model shapes as an enum with data (a tagged union): circle r, square s, rect w h. Read n shapes and print each area with two decimals. Use π = 3.14159265358979.
Input: n, then n shape lines.
Output: One area per line.
Difficulty: Medium. Write your answer in the browser editor, run the examples, then submit it against hidden tests. Python and JavaScript are free; other languages are part of licode Club.
Hint
- Rust: enum Shape { Circle(f64), Square(f64), Rect(f64, f64) }.