/**
 * This function calculates the total budget required for interior design items.
 *
 * @param items A list of interior design items required.
 * @param itemPrices A map containing item names as keys and their respective prices as values.
 * @return The total budget required rounded to 2 decimal places.
 */
fun calculateBudget(items: List<String>, itemPrices: Map<String, Double>): Double {

    var totalBudget = 0.0
    for (item in items) {
        if (item in itemPrices) {
            totalBudget += itemPrices[item] ?: 0.0
        }
    }
    return totalBudget.round(2)
}

fun Double.round(decimals: Int): Double {
    var multiplier = 1.0
    repeat(decimals) { multiplier *= 10 }
    return kotlin.math.round(this * multiplier) / multiplier
}
/**
 * This function calculates the total budget required for interior design items.
 *
 * @param items A list of interior design items required.
 * @param itemPrices A map containing item names as keys and their respective prices as values.
 * @return The total budget required rounded to 2 decimal places.
 */
fun calculateBudget(items: List<String>, itemPrices: Map<String, Double>): Double {
/**
 * This function calculates the total budget required for interior design items.
 *
 * @param items A list of interior design items required.
 * @param itemPrices A map containing item names as keys and their respective prices as values.
 * @return The total budget required rounded to 2 decimal places.
 */
fun calculateBudget(items: List<String>, itemPrices: Map<String, Double>): Double {

    var totalBudget = 0.0
    for (item in items) {
        if (item in itemPrices) {
            totalBudget += itemPrices[item] ?: 0.0
        }
    }
    return totalBudget.round(2)
}

fun Double.round(decimals: Int): Double {
    var multiplier = 1.0
    repeat(decimals) { multiplier *= 10 }
    return kotlin.math.round(this * multiplier) / multiplier
}