A Java application that calculates the area of various geometric shapes using sealed classes and records.
| Shape | Formula | Parameters |
|---|---|---|
| Circle | π × r² | Radius |
| Rectangle | l × w | Length, Width |
| Square | s² | Side |
| Triangle | ½ × b × h | Base, Height |
| Trapezoid | ½ × (a + b) × h | Side A, Side B, Height |
| Ellipse | π × a × b | Semi-major axis, Semi-minor axis |
| Rhombus | ½ × d₁ × d₂ | Diagonal 1, Diagonal 2 |
| Regular Polygon | (n × s²) / (4 × tan(π/n)) | Number of sides, Side length |
| Sector | ½ × r² × θ | Radius, Central angle (degrees) |
- Java 21 or later (uses sealed classes and records)