/**
 * Given a list of dictionaries representing pets, each having 'name' and 'visits' keys,
 * calculate the total expenses incurred on pet visits to a veterinarian. The cost of each
 * visit depends on the number of visits made by the pet. If the number of visits is less
 * than or equal to 5, the cost per visit is $50, otherwise, it is $40.
 *
 * @param petData A list of dictionaries where each dictionary contains the keys 'name' and 'visits'.
 * @return The total expenses incurred on pet visits.
 */
fun calculateExpenses(petData: List<Map<String, Any>>): Double {

    var totalExpenses = 0.0

    for (pet in petData) {
        totalExpenses += if (pet["visits"] as Int <= 5) 50.0 else 40.0
    }

    return totalExpenses
}
/**
 * Given a list of dictionaries representing pets, each having 'name' and 'visits' keys,
 * calculate the total expenses incurred on pet visits to a veterinarian. The cost of each
 * visit depends on the number of visits made by the pet. If the number of visits is less
 * than or equal to 5, the cost per visit is $50, otherwise, it is $40.
 *
 * @param petData A list of dictionaries where each dictionary contains the keys 'name' and 'visits'.
 * @return The total expenses incurred on pet visits.
 */
fun calculateExpenses(petData: List<Map<String, Any>>): Double {
/**
 * Given a list of dictionaries representing pets, each having 'name' and 'visits' keys,
 * calculate the total expenses incurred on pet visits to a veterinarian. The cost of each
 * visit depends on the number of visits made by the pet. If the number of visits is less
 * than or equal to 5, the cost per visit is $50, otherwise, it is $40.
 *
 * @param petData A list of dictionaries where each dictionary contains the keys 'name' and 'visits'.
 * @return The total expenses incurred on pet visits.
 */
fun calculateExpenses(petData: List<Map<String, Any>>): Double {

    var totalExpenses = 0.0

    for (pet in petData) {
        totalExpenses += if (pet["visits"] as Int <= 5) 50.0 else 40.0
    }

    return totalExpenses
}