/**
 * Calculate the total expenses for a specific category from a list of transactions.
 *
 * @param transactions A list of transactions consisting of (date, amount, category).
 * @param category The category for which to calculate the total expenses.
 * @return The total expenses for the given category.
 *
 * Example:
 * calculateTotalExpenses(listOf(
 *     Triple("2021-01-01", 100.0, "Food"),
 *     Triple("2021-01-02", 50.0, "Utilities"),
 *     Triple("2021-01-03", 75.0, "Food"),
 *     Triple("2021-01-04", 200.0, "Transportation")
 * ), "Food")
 * Expected output: 175.0
 */
fun calculateTotalExpenses(transactions: List<Triple<String, Double, String>>, category: String): Double {

    var totalExpenses = 0.0

    // Loop through each transaction
    for (transaction in transactions) {
        val (_, amount, cat) = transaction

        // Check if the transaction category matches the given category
        if (cat == category) {
            // Add the amount to the total expenses
            totalExpenses += amount
        }
    }

    return totalExpenses
}
/**
 * Calculate the total expenses for a specific category from a list of transactions.
 *
 * @param transactions A list of transactions consisting of (date, amount, category).
 * @param category The category for which to calculate the total expenses.
 * @return The total expenses for the given category.
 *
 * Example:
 * calculateTotalExpenses(listOf(
 *     Triple("2021-01-01", 100.0, "Food"),
 *     Triple("2021-01-02", 50.0, "Utilities"),
 *     Triple("2021-01-03", 75.0, "Food"),
 *     Triple("2021-01-04", 200.0, "Transportation")
 * ), "Food")
 * Expected output: 175.0
 */
fun calculateTotalExpenses(transactions: List<Triple<String, Double, String>>, category: String): Double {
/**
 * Calculate the total expenses for a specific category from a list of transactions.
 *
 * @param transactions A list of transactions consisting of (date, amount, category).
 * @param category The category for which to calculate the total expenses.
 * @return The total expenses for the given category.
 *
 * Example:
 * calculateTotalExpenses(listOf(
 *     Triple("2021-01-01", 100.0, "Food"),
 *     Triple("2021-01-02", 50.0, "Utilities"),
 *     Triple("2021-01-03", 75.0, "Food"),
 *     Triple("2021-01-04", 200.0, "Transportation")
 * ), "Food")
 * Expected output: 175.0
 */
fun calculateTotalExpenses(transactions: List<Triple<String, Double, String>>, category: String): Double {

    var totalExpenses = 0.0

    // Loop through each transaction
    for (transaction in transactions) {
        val (_, amount, cat) = transaction

        // Check if the transaction category matches the given category
        if (cat == category) {
            // Add the amount to the total expenses
            totalExpenses += amount
        }
    }

    return totalExpenses
}