/**
 * You are an accountant and you need to calculate the total expenses for a client. The client's income and expenses
 * are given as parameters. Your task is to complete the function to calculate the total expenses and return it.
 *
 * @param income The total income earned by the client.
 * @param expenses A string containing all the expenses separated by commas. Each expense is in the format "name:amount".
 * @return The total expenses incurred by the client.
 */
fun calculateTotalExpenses(income: Double, expenses: String): Double {

    // Splitting the expenses string into individual expenses
    val expenseList = expenses.split(",")

    // Initializing the totalExpenses variable
    var totalExpenses = 0.0

    // Looping through each expense
    for (expense in expenseList) {
        // Extracting the amount from each expense
        val amount = expense.split(":")[1].toDouble()

        // Adding the amount to the totalExpenses
        totalExpenses += amount
    }

    return totalExpenses
}
/**
 * You are an accountant and you need to calculate the total expenses for a client. The client's income and expenses
 * are given as parameters. Your task is to complete the function to calculate the total expenses and return it.
 *
 * @param income The total income earned by the client.
 * @param expenses A string containing all the expenses separated by commas. Each expense is in the format "name:amount".
 * @return The total expenses incurred by the client.
 */
fun calculateTotalExpenses(income: Double, expenses: String): Double {
/**
 * You are an accountant and you need to calculate the total expenses for a client. The client's income and expenses
 * are given as parameters. Your task is to complete the function to calculate the total expenses and return it.
 *
 * @param income The total income earned by the client.
 * @param expenses A string containing all the expenses separated by commas. Each expense is in the format "name:amount".
 * @return The total expenses incurred by the client.
 */
fun calculateTotalExpenses(income: Double, expenses: String): Double {

    // Splitting the expenses string into individual expenses
    val expenseList = expenses.split(",")

    // Initializing the totalExpenses variable
    var totalExpenses = 0.0

    // Looping through each expense
    for (expense in expenseList) {
        // Extracting the amount from each expense
        val amount = expense.split(":")[1].toDouble()

        // Adding the amount to the totalExpenses
        totalExpenses += amount
    }

    return totalExpenses
}