/**
 * Given a list of tuples where each tuple represents the data for an aircraft, calculate the average speed of all the aircrafts.
 *
 * The tuple contains nested tuples where the first element represents the aircraft's name,
 * the second element represents the initial speed in km/h, and the third element represents the time in hours taken to reach the final speed.
 *
 * @param aircraftData List of tuples representing aircraft data.
 * @return The average speed of all the aircrafts in km/h.
 *
 * Example:
 * val aircraftData = listOf(
 *     Triple("Aircraft1", 100, 2),
 *     Triple("Aircraft2", 200, 3),
 *     Triple("Aircraft3", 150, 4),
 *     Triple("Aircraft4", 120, 5)
 * )
 * calculateAverageSpeed(aircraftData) => 135.0
 */
fun calculateAverageSpeed(aircraftData: List<Triple<String, Int, Int>>): Double {

    val totalSpeed = aircraftData.sumBy { it.second * it.third }
    val totalTime = aircraftData.sumBy { it.third }
    return totalSpeed.toDouble() / totalTime
}
/**
 * Given a list of tuples where each tuple represents the data for an aircraft, calculate the average speed of all the aircrafts.
 *
 * The tuple contains nested tuples where the first element represents the aircraft's name,
 * the second element represents the initial speed in km/h, and the third element represents the time in hours taken to reach the final speed.
 *
 * @param aircraftData List of tuples representing aircraft data.
 * @return The average speed of all the aircrafts in km/h.
 *
 * Example:
 * val aircraftData = listOf(
 *     Triple("Aircraft1", 100, 2),
 *     Triple("Aircraft2", 200, 3),
 *     Triple("Aircraft3", 150, 4),
 *     Triple("Aircraft4", 120, 5)
 * )
 * calculateAverageSpeed(aircraftData) => 135.0
 */
fun calculateAverageSpeed(aircraftData: List<Triple<String, Int, Int>>): Double {
/**
 * Given a list of tuples where each tuple represents the data for an aircraft, calculate the average speed of all the aircrafts.
 *
 * The tuple contains nested tuples where the first element represents the aircraft's name,
 * the second element represents the initial speed in km/h, and the third element represents the time in hours taken to reach the final speed.
 *
 * @param aircraftData List of tuples representing aircraft data.
 * @return The average speed of all the aircrafts in km/h.
 *
 * Example:
 * val aircraftData = listOf(
 *     Triple("Aircraft1", 100, 2),
 *     Triple("Aircraft2", 200, 3),
 *     Triple("Aircraft3", 150, 4),
 *     Triple("Aircraft4", 120, 5)
 * )
 * calculateAverageSpeed(aircraftData) => 135.0
 */
fun calculateAverageSpeed(aircraftData: List<Triple<String, Int, Int>>): Double {

    val totalSpeed = aircraftData.sumBy { it.second * it.third }
    val totalTime = aircraftData.sumBy { it.third }
    return totalSpeed.toDouble() / totalTime
}