/**
 * Given a map of flight data containing the duration (in minutes) and distance (in miles) of multiple flights,
 * calculate the average speed (in miles per hour) of all the flights combined.
 *
 * @param flightData A map where the keys represent flight numbers and the values are maps
 *                    containing keys 'duration' and 'distance' with corresponding integer values.
 * @return The average speed of all the flights combined in miles per hour.
 */
fun calculateAverageSpeed(flightData: Map<String, Map<String, Int>>): Double {

    var totalDuration = 0
    var totalDistance = 0

    for ((_, data) in flightData) {
        totalDuration += data["duration"] ?: 0
        totalDistance += data["distance"] ?: 0
    }

    val averageSpeed = (totalDistance.toDouble() / totalDuration) * 60  // Multiplying by 60 to convert minutes to hours

    return averageSpeed
}
/**
 * Given a map of flight data containing the duration (in minutes) and distance (in miles) of multiple flights,
 * calculate the average speed (in miles per hour) of all the flights combined.
 *
 * @param flightData A map where the keys represent flight numbers and the values are maps
 *                    containing keys 'duration' and 'distance' with corresponding integer values.
 * @return The average speed of all the flights combined in miles per hour.
 */
fun calculateAverageSpeed(flightData: Map<String, Map<String, Int>>): Double {
/**
 * Given a map of flight data containing the duration (in minutes) and distance (in miles) of multiple flights,
 * calculate the average speed (in miles per hour) of all the flights combined.
 *
 * @param flightData A map where the keys represent flight numbers and the values are maps
 *                    containing keys 'duration' and 'distance' with corresponding integer values.
 * @return The average speed of all the flights combined in miles per hour.
 */
fun calculateAverageSpeed(flightData: Map<String, Map<String, Int>>): Double {

    var totalDuration = 0
    var totalDistance = 0

    for ((_, data) in flightData) {
        totalDuration += data["duration"] ?: 0
        totalDistance += data["distance"] ?: 0
    }

    val averageSpeed = (totalDistance.toDouble() / totalDuration) * 60  // Multiplying by 60 to convert minutes to hours

    return averageSpeed
}