/**
 * Given a dictionary containing the milk yield of each cow on a farm,
 * the function calculates the average milk yield of all the cows.
 *
 * @param farmerData A dictionary where the keys represent the cow IDs and
 *                   the values represent the milk yield in liters.
 * @return The average milk yield of all the cows on the farm.
 *
 * Example:
 * val farmerData = mapOf("M01" to 15.2, "M02" to 12.8, "M03" to 19.6, "M04" to 16.5, "M05" to 14.9)
 * getAverageMilkYield(farmerData) // 15.8
 */
fun getAverageMilkYield(farmerData: Map<String, Double>): Double {

    var milkYieldSum = 0.0  // Variable to store the sum of milk yields
    var cowCount = 0  // Variable to store the number of cows

    for ((_, milkYield) in farmerData) {
        if (milkYield > 10) {
            milkYieldSum += milkYield
            cowCount++
        }
    }

    return milkYieldSum / cowCount
}
/**
 * Given a dictionary containing the milk yield of each cow on a farm,
 * the function calculates the average milk yield of all the cows.
 *
 * @param farmerData A dictionary where the keys represent the cow IDs and
 *                   the values represent the milk yield in liters.
 * @return The average milk yield of all the cows on the farm.
 *
 * Example:
 * val farmerData = mapOf("M01" to 15.2, "M02" to 12.8, "M03" to 19.6, "M04" to 16.5, "M05" to 14.9)
 * getAverageMilkYield(farmerData) // 15.8
 */
fun getAverageMilkYield(farmerData: Map<String, Double>): Double {
/**
 * Given a dictionary containing the milk yield of each cow on a farm,
 * the function calculates the average milk yield of all the cows.
 *
 * @param farmerData A dictionary where the keys represent the cow IDs and
 *                   the values represent the milk yield in liters.
 * @return The average milk yield of all the cows on the farm.
 *
 * Example:
 * val farmerData = mapOf("M01" to 15.2, "M02" to 12.8, "M03" to 19.6, "M04" to 16.5, "M05" to 14.9)
 * getAverageMilkYield(farmerData) // 15.8
 */
fun getAverageMilkYield(farmerData: Map<String, Double>): Double {

    var milkYieldSum = 0.0  // Variable to store the sum of milk yields
    var cowCount = 0  // Variable to store the number of cows

    for ((_, milkYield) in farmerData) {
        if (milkYield > 10) {
            milkYieldSum += milkYield
            cowCount++
        }
    }

    return milkYieldSum / cowCount
}