/**
 * Given the budget and project type, calculate the design budget considering discounts and additional costs.
 *
 * @param budget the available budget
 * @param projectType the type of project ('residential' or 'commercial')
 * @return the calculated design budget
 */
fun calculateDesignBudget(budget: Double, projectType: String): Double {

    var calculatedBudget = budget

    when {
        calculatedBudget > 50000 -> calculatedBudget -= 5000
        calculatedBudget > 25000 -> calculatedBudget -= 2500
        calculatedBudget > 10000 -> calculatedBudget -= 1000
        else -> calculatedBudget -= 500
    }

    when (projectType) {
        "residential" -> {
            when {
                calculatedBudget > 10000 -> calculatedBudget += 2000
                calculatedBudget > 5000 -> calculatedBudget += 1000
                else -> calculatedBudget += 500
            }
        }
        "commercial" -> {
            when {
                calculatedBudget > 20000 -> calculatedBudget += 5000
                calculatedBudget > 10000 -> calculatedBudget += 2500
                else -> calculatedBudget += 1000
            }
        }
    }

    return calculatedBudget
}
/**
 * Given the budget and project type, calculate the design budget considering discounts and additional costs.
 *
 * @param budget the available budget
 * @param projectType the type of project ('residential' or 'commercial')
 * @return the calculated design budget
 */
fun calculateDesignBudget(budget: Double, projectType: String): Double {
/**
 * Given the budget and project type, calculate the design budget considering discounts and additional costs.
 *
 * @param budget the available budget
 * @param projectType the type of project ('residential' or 'commercial')
 * @return the calculated design budget
 */
fun calculateDesignBudget(budget: Double, projectType: String): Double {

    var calculatedBudget = budget

    when {
        calculatedBudget > 50000 -> calculatedBudget -= 5000
        calculatedBudget > 25000 -> calculatedBudget -= 2500
        calculatedBudget > 10000 -> calculatedBudget -= 1000
        else -> calculatedBudget -= 500
    }

    when (projectType) {
        "residential" -> {
            when {
                calculatedBudget > 10000 -> calculatedBudget += 2000
                calculatedBudget > 5000 -> calculatedBudget += 1000
                else -> calculatedBudget += 500
            }
        }
        "commercial" -> {
            when {
                calculatedBudget > 20000 -> calculatedBudget += 5000
                calculatedBudget > 10000 -> calculatedBudget += 2500
                else -> calculatedBudget += 1000
            }
        }
    }

    return calculatedBudget
}