/**
 * Given a dictionary of fruits and their corresponding prices, calculate the total farming profit.
 *
 * @param fruits A dictionary where keys are strings representing fruit names, and values are integers representing the quantity.
 * @param prices A dictionary where keys are strings representing fruit names, and values are floats representing the price per fruit.
 * @return The total farming profit.
 *
 * Example:
 * calculateFarmingProfit(mapOf("apple" to 10, "banana" to 20, "orange" to 15), mapOf("apple" to 0.5, "banana" to 0.3, "orange" to 0.2)) returns 13.5
 * calculateFarmingProfit(mapOf("apple" to 5, "peach" to 8), mapOf("apple" to 0.7, "peach" to 0.5)) returns 5.5
 */
fun calculateFarmingProfit(fruits: Map<String, Int>, prices: Map<String, Double>): Double {

    var totalProfit = 0.0

    for ((fruit, quantity) in fruits) {
        val currentPrice = prices[fruit] ?: 0.0
        totalProfit += quantity * currentPrice
    }

    return totalProfit
}
/**
 * Given a dictionary of fruits and their corresponding prices, calculate the total farming profit.
 *
 * @param fruits A dictionary where keys are strings representing fruit names, and values are integers representing the quantity.
 * @param prices A dictionary where keys are strings representing fruit names, and values are floats representing the price per fruit.
 * @return The total farming profit.
 *
 * Example:
 * calculateFarmingProfit(mapOf("apple" to 10, "banana" to 20, "orange" to 15), mapOf("apple" to 0.5, "banana" to 0.3, "orange" to 0.2)) returns 13.5
 * calculateFarmingProfit(mapOf("apple" to 5, "peach" to 8), mapOf("apple" to 0.7, "peach" to 0.5)) returns 5.5
 */
fun calculateFarmingProfit(fruits: Map<String, Int>, prices: Map<String, Double>): Double {
/**
 * Given a dictionary of fruits and their corresponding prices, calculate the total farming profit.
 *
 * @param fruits A dictionary where keys are strings representing fruit names, and values are integers representing the quantity.
 * @param prices A dictionary where keys are strings representing fruit names, and values are floats representing the price per fruit.
 * @return The total farming profit.
 *
 * Example:
 * calculateFarmingProfit(mapOf("apple" to 10, "banana" to 20, "orange" to 15), mapOf("apple" to 0.5, "banana" to 0.3, "orange" to 0.2)) returns 13.5
 * calculateFarmingProfit(mapOf("apple" to 5, "peach" to 8), mapOf("apple" to 0.7, "peach" to 0.5)) returns 5.5
 */
fun calculateFarmingProfit(fruits: Map<String, Int>, prices: Map<String, Double>): Double {

    var totalProfit = 0.0

    for ((fruit, quantity) in fruits) {
        val currentPrice = prices[fruit] ?: 0.0
        totalProfit += quantity * currentPrice
    }

    return totalProfit
}