/**
 * This function calculates the total cost for furnishing a room based on the provided room dimensions
 * and a map of furniture items with their corresponding prices.
 *
 * @param roomDimensions A map containing the length, width, and height of the room.
 * @param furnitureItems A map containing furniture items as keys and their prices as values.
 * @return The total cost for furnishing the room.
 */
fun calculateTotalCost(roomDimensions: Map<String, Int>, furnitureItems: Map<String, Double>): Double {

    var totalCost = 0.0

    if (roomDimensions["length"]!! <= 0 || roomDimensions["width"]!! <= 0 || roomDimensions["height"]!! <= 0) {
        println("Invalid room dimensions!")
        return totalCost
    }

    for ((item, price) in furnitureItems) {
        print("How many $item(s) do you want to purchase? ")
        val quantity = readLine()!!.toInt()
        totalCost += price * quantity
    }

    return totalCost
}

val roomDimensions = mapOf("length" to 10, "width" to 12, "height" to 8)
val furnitureItems = mapOf("chair" to 50.0, "table" to 100.0, "sofa" to 200.0, "lamp" to 25.0)
/**
 * This function calculates the total cost for furnishing a room based on the provided room dimensions
 * and a map of furniture items with their corresponding prices.
 *
 * @param roomDimensions A map containing the length, width, and height of the room.
 * @param furnitureItems A map containing furniture items as keys and their prices as values.
 * @return The total cost for furnishing the room.
 */
fun calculateTotalCost(roomDimensions: Map<String, Int>, furnitureItems: Map<String, Double>): Double {
/**
 * This function calculates the total cost for furnishing a room based on the provided room dimensions
 * and a map of furniture items with their corresponding prices.
 *
 * @param roomDimensions A map containing the length, width, and height of the room.
 * @param furnitureItems A map containing furniture items as keys and their prices as values.
 * @return The total cost for furnishing the room.
 */
fun calculateTotalCost(roomDimensions: Map<String, Int>, furnitureItems: Map<String, Double>): Double {

    var totalCost = 0.0

    if (roomDimensions["length"]!! <= 0 || roomDimensions["width"]!! <= 0 || roomDimensions["height"]!! <= 0) {
        println("Invalid room dimensions!")
        return totalCost
    }

    for ((item, price) in furnitureItems) {
        print("How many $item(s) do you want to purchase? ")
        val quantity = readLine()!!.toInt()
        totalCost += price * quantity
    }

    return totalCost
}

val roomDimensions = mapOf("length" to 10, "width" to 12, "height" to 8)
val furnitureItems = mapOf("chair" to 50.0, "table" to 100.0, "sofa" to 200.0, "lamp" to 25.0)