/**
 * This function subtracts a certain fee from the balance of each pet's owner in a veterinarian's database.
 */
fun subtractAssignmentVeterinarian(pets: MutableList<HashMap<String, Any>>, fee: Int): MutableList<HashMap<String, Any>> {

    // Iterate through each pet in the database
    for (pet in pets) {
        // Access the owner and balance of the current pet
        val owner = pet["owner"] as String
        var balance = pet["balance"] as Int

        // Condition to check if the owner has enough balance to pay the fee
        if (balance >= fee) {
            // Subtract the fee from the owner's balance
            balance -= fee
            pet["balance"] = balance
        } else {
            // Not enough balance, display an error message
            println("$owner doesn't have enough balance to pay the fee.")
        }
    }

    // Return the updated database of pets
    return pets
}

// Example usage
val petsDatabase = mutableListOf(
    hashMapOf("name" to "Fluffy", "owner" to "John", "balance" to 200),
    hashMapOf("name" to "Bubbles", "owner" to "Emma", "balance" to 100),
    hashMapOf("name" to "Max", "owner" to "Alex", "balance" to 50),
    hashMapOf("name" to "Sasha", "owner" to "John", "balance" to 300)
)
/**
 * This function subtracts a certain fee from the balance of each pet's owner in a veterinarian's database.
 */
fun subtractAssignmentVeterinarian(pets: MutableList<HashMap<String, Any>>, fee: Int): MutableList<HashMap<String, Any>> {
/**
 * This function subtracts a certain fee from the balance of each pet's owner in a veterinarian's database.
 */
fun subtractAssignmentVeterinarian(pets: MutableList<HashMap<String, Any>>, fee: Int): MutableList<HashMap<String, Any>> {

    // Iterate through each pet in the database
    for (pet in pets) {
        // Access the owner and balance of the current pet
        val owner = pet["owner"] as String
        var balance = pet["balance"] as Int

        // Condition to check if the owner has enough balance to pay the fee
        if (balance >= fee) {
            // Subtract the fee from the owner's balance
            balance -= fee
            pet["balance"] = balance
        } else {
            // Not enough balance, display an error message
            println("$owner doesn't have enough balance to pay the fee.")
        }
    }

    // Return the updated database of pets
    return pets
}

// Example usage
val petsDatabase = mutableListOf(
    hashMapOf("name" to "Fluffy", "owner" to "John", "balance" to 200),
    hashMapOf("name" to "Bubbles", "owner" to "Emma", "balance" to 100),
    hashMapOf("name" to "Max", "owner" to "Alex", "balance" to 50),
    hashMapOf("name" to "Sasha", "owner" to "John", "balance" to 300)
)