/**
 * A function that determines the cost of furniture for an interior designer.
 *
 * @param furniturePrices A list of tuples where each tuple contains the furniture name as a string and its corresponding price.
 * @return The total cost of all the furniture.
 *
 * Exercise:
 * Complete the code below to calculate the total cost of all the furniture using a for loop
 * and the enumerate function.
 *
 * Difficulty:
 * Difficult
 */
fun calculateFurnitureCosts(furniturePrices: List<Pair<String, Double>>): Double {

    var totalCost = 0.0

    // Write a for loop using the withIndex function to access both the index and value of each furniture
    // in the furniturePrices list. Use the provided index to print a message for each furniture in the format:
    // "Furniture #<index>: <furnitureName> - Cost: $<furniturePrice>"
    // Finally, update the totalCost variable with the price of each furniture.

    for ((index, furniture) in furniturePrices.withIndex()) {
        // Get the furniture name and price from the pair
        val (furnitureName, furniturePrice) = furniture

        // Print the furniture information
        println("Furniture #${index + 1}: $furnitureName - Cost: $$furniturePrice")

        // Update the total cost
        totalCost += furniturePrice
    }

    return totalCost
}
/**
 * A function that determines the cost of furniture for an interior designer.
 *
 * @param furniturePrices A list of tuples where each tuple contains the furniture name as a string and its corresponding price.
 * @return The total cost of all the furniture.
 *
 * Exercise:
 * Complete the code below to calculate the total cost of all the furniture using a for loop
 * and the enumerate function.
 *
 * Difficulty:
 * Difficult
 */
fun calculateFurnitureCosts(furniturePrices: List<Pair<String, Double>>): Double {
/**
 * A function that determines the cost of furniture for an interior designer.
 *
 * @param furniturePrices A list of tuples where each tuple contains the furniture name as a string and its corresponding price.
 * @return The total cost of all the furniture.
 *
 * Exercise:
 * Complete the code below to calculate the total cost of all the furniture using a for loop
 * and the enumerate function.
 *
 * Difficulty:
 * Difficult
 */
fun calculateFurnitureCosts(furniturePrices: List<Pair<String, Double>>): Double {

    var totalCost = 0.0

    // Write a for loop using the withIndex function to access both the index and value of each furniture
    // in the furniturePrices list. Use the provided index to print a message for each furniture in the format:
    // "Furniture #<index>: <furnitureName> - Cost: $<furniturePrice>"
    // Finally, update the totalCost variable with the price of each furniture.

    for ((index, furniture) in furniturePrices.withIndex()) {
        // Get the furniture name and price from the pair
        val (furnitureName, furniturePrice) = furniture

        // Print the furniture information
        println("Furniture #${index + 1}: $furnitureName - Cost: $$furniturePrice")

        // Update the total cost
        totalCost += furniturePrice
    }

    return totalCost
}