/**
 * Given a map representing geological data, the function calculates the average elevation of all data points.
 *
 * @param geologicalData A map containing key-value pairs representing different geological sites and their respective elevation.
 * @return The average elevation of all the given sites.
 * @throws IllegalArgumentException If the map is empty.
 * @throws NumberFormatException If any of the elevation values is non-numeric.
 *
 * Example:
 * calculateAverageElevation(mapOf("SiteA" to 100, "SiteB" to 200, "SiteC" to 150)) returns 150.0
 */
fun calculateAverageElevation(geologicalData: Map<String, Int>): Double {

    if (geologicalData.isEmpty()) {
        throw IllegalArgumentException("Empty map detected!")
    }

    var totalElevation = 0
    var validDataPoints = 0

    for ((_, elevation) in geologicalData) {
        totalElevation += elevation
        validDataPoints++
    }

    return totalElevation.toDouble() / validDataPoints
}
/**
 * Given a map representing geological data, the function calculates the average elevation of all data points.
 *
 * @param geologicalData A map containing key-value pairs representing different geological sites and their respective elevation.
 * @return The average elevation of all the given sites.
 * @throws IllegalArgumentException If the map is empty.
 * @throws NumberFormatException If any of the elevation values is non-numeric.
 *
 * Example:
 * calculateAverageElevation(mapOf("SiteA" to 100, "SiteB" to 200, "SiteC" to 150)) returns 150.0
 */
fun calculateAverageElevation(geologicalData: Map<String, Int>): Double {
/**
 * Given a map representing geological data, the function calculates the average elevation of all data points.
 *
 * @param geologicalData A map containing key-value pairs representing different geological sites and their respective elevation.
 * @return The average elevation of all the given sites.
 * @throws IllegalArgumentException If the map is empty.
 * @throws NumberFormatException If any of the elevation values is non-numeric.
 *
 * Example:
 * calculateAverageElevation(mapOf("SiteA" to 100, "SiteB" to 200, "SiteC" to 150)) returns 150.0
 */
fun calculateAverageElevation(geologicalData: Map<String, Int>): Double {

    if (geologicalData.isEmpty()) {
        throw IllegalArgumentException("Empty map detected!")
    }

    var totalElevation = 0
    var validDataPoints = 0

    for ((_, elevation) in geologicalData) {
        totalElevation += elevation
        validDataPoints++
    }

    return totalElevation.toDouble() / validDataPoints
}