/**
 * This function updates the income statement of an accountant by subtracting the expenses from the revenue.
 *
 * @param incomeStatement A list containing different categories of revenue and expenses.
 * @param expenseList A list containing the amounts of various expenses.
 * @return Updated income statement after subtracting the expenses from the revenue.
 */
fun updateIncomeStatement(incomeStatement: MutableList<Pair<String, Double>>, expenseList: List<Pair<String, Double>>): MutableList<Pair<String, Double>> {

    // Iterate over the expenses
    for (expense in expenseList) {
        // Find the matching revenue category
        for (i in incomeStatement.indices) {
            // Extract the revenue category and amount
            val (revenueCategory, revenueAmount) = incomeStatement[i]

            // Check if the revenue category matches the expense category
            if (revenueCategory == expense.first) {
                // Update the revenue amount by subtracting the expense amount
                incomeStatement[i] = Pair(revenueCategory, revenueAmount - expense.second)
                break
            }
        }
    }

    return incomeStatement
}
/**
 * This function updates the income statement of an accountant by subtracting the expenses from the revenue.
 *
 * @param incomeStatement A list containing different categories of revenue and expenses.
 * @param expenseList A list containing the amounts of various expenses.
 * @return Updated income statement after subtracting the expenses from the revenue.
 */
fun updateIncomeStatement(incomeStatement: MutableList<Pair<String, Double>>, expenseList: List<Pair<String, Double>>): MutableList<Pair<String, Double>> {
/**
 * This function updates the income statement of an accountant by subtracting the expenses from the revenue.
 *
 * @param incomeStatement A list containing different categories of revenue and expenses.
 * @param expenseList A list containing the amounts of various expenses.
 * @return Updated income statement after subtracting the expenses from the revenue.
 */
fun updateIncomeStatement(incomeStatement: MutableList<Pair<String, Double>>, expenseList: List<Pair<String, Double>>): MutableList<Pair<String, Double>> {

    // Iterate over the expenses
    for (expense in expenseList) {
        // Find the matching revenue category
        for (i in incomeStatement.indices) {
            // Extract the revenue category and amount
            val (revenueCategory, revenueAmount) = incomeStatement[i]

            // Check if the revenue category matches the expense category
            if (revenueCategory == expense.first) {
                // Update the revenue amount by subtracting the expense amount
                incomeStatement[i] = Pair(revenueCategory, revenueAmount - expense.second)
                break
            }
        }
    }

    return incomeStatement
}