package math
import java.lang.IllegalArgumentException
import kotlin.math.pow
fun areaOfARectangle(length: Double, width: Double) = when {
length > 0 && width > 0 -> length * width
else -> throw IllegalArgumentException("Length and Width must be positive")
}
fun areaOfASquare(sideLength: Double) =
when {
sideLength > 0 -> sideLength * sideLength
else -> throw IllegalArgumentException("Side Length must be positive")
}
fun areaOfATriangle(base: Double, height: Double) =
when {
base > 0 && height > 0 -> base * height / 2
else -> throw IllegalArgumentException("Base and Height must be positive")
}
fun areaOfACircle(radius: Double) =
when {
radius > 0 -> Math.PI * radius.pow(2.0)
else -> throw IllegalArgumentException("Radius must be positive")
}