/**
 * Calculate the tax to be paid by an accountant.
 *
 * @param income The total income of the accountant.
 * @param deductions The total deductions claimed by the accountant.
 * @return The tax amount to be paid by the accountant.
 */
fun calculateTax(income: Double, deductions: Double): Double {

    // If the income is less than or equal to 0, return 0 immediately
    if (income <= 0) {
        return 0.0
    }

    // If the income is less than or equal to the deductions, no tax needs to be paid
    if (income <= deductions) {
        return 0.0
    }

    // Calculate the taxable income
    val taxableIncome = income - deductions

    // If the taxable income is less than or equal to 50000, return 0.2 times the taxable income
    if (taxableIncome <= 50000) {
        return 0.2 * taxableIncome
    }

    // If the taxable income is less than or equal to 100000, return 0.3 times the taxable income
    if (taxableIncome <= 100000) {
        return 0.3 * taxableIncome
    }

    // If the taxable income is greater than 100000, calculate tax based on higher rates
    return 0.4 * taxableIncome
}
/**
 * Calculate the tax to be paid by an accountant.
 *
 * @param income The total income of the accountant.
 * @param deductions The total deductions claimed by the accountant.
 * @return The tax amount to be paid by the accountant.
 */
fun calculateTax(income: Double, deductions: Double): Double {
/**
 * Calculate the tax to be paid by an accountant.
 *
 * @param income The total income of the accountant.
 * @param deductions The total deductions claimed by the accountant.
 * @return The tax amount to be paid by the accountant.
 */
fun calculateTax(income: Double, deductions: Double): Double {

    // If the income is less than or equal to 0, return 0 immediately
    if (income <= 0) {
        return 0.0
    }

    // If the income is less than or equal to the deductions, no tax needs to be paid
    if (income <= deductions) {
        return 0.0
    }

    // Calculate the taxable income
    val taxableIncome = income - deductions

    // If the taxable income is less than or equal to 50000, return 0.2 times the taxable income
    if (taxableIncome <= 50000) {
        return 0.2 * taxableIncome
    }

    // If the taxable income is less than or equal to 100000, return 0.3 times the taxable income
    if (taxableIncome <= 100000) {
        return 0.3 * taxableIncome
    }

    // If the taxable income is greater than 100000, calculate tax based on higher rates
    return 0.4 * taxableIncome
}