/**
 * This function calculates the total discount for a photographer based on the price of the photos, number of photos
 * purchased, and whether the photographer is a professional or not.
 *
 * @param price The unit price of each photo.
 * @param numPhotos The number of photos purchased.
 * @param isProfessional Whether the photographer is a professional or not.
 * @return The total discount applied to the purchase.
 */
fun calculateDiscount(price: Double, numPhotos: Int, isProfessional: Boolean): Double {

    var discount = 0.0

    if (price < 0 || numPhotos < 0) {
        return 0.0 // Invalid input. Price and number of photos should be positive values.
    }

    val totalPrice = price * numPhotos

    discount = when {
        numPhotos >= 10 -> totalPrice * 0.1
        numPhotos >= 5 -> totalPrice * 0.05
        else -> 0.0
    }

    if (isProfessional) {
        discount += totalPrice * 0.03
    }

    return discount
}

// Complete the code below by using the ternary operator and break statement to calculate the final price.
/**
 * This function calculates the total discount for a photographer based on the price of the photos, number of photos
 * purchased, and whether the photographer is a professional or not.
 *
 * @param price The unit price of each photo.
 * @param numPhotos The number of photos purchased.
 * @param isProfessional Whether the photographer is a professional or not.
 * @return The total discount applied to the purchase.
 */
fun calculateDiscount(price: Double, numPhotos: Int, isProfessional: Boolean): Double {
/**
 * This function calculates the total discount for a photographer based on the price of the photos, number of photos
 * purchased, and whether the photographer is a professional or not.
 *
 * @param price The unit price of each photo.
 * @param numPhotos The number of photos purchased.
 * @param isProfessional Whether the photographer is a professional or not.
 * @return The total discount applied to the purchase.
 */
fun calculateDiscount(price: Double, numPhotos: Int, isProfessional: Boolean): Double {

    var discount = 0.0

    if (price < 0 || numPhotos < 0) {
        return 0.0 // Invalid input. Price and number of photos should be positive values.
    }

    val totalPrice = price * numPhotos

    discount = when {
        numPhotos >= 10 -> totalPrice * 0.1
        numPhotos >= 5 -> totalPrice * 0.05
        else -> 0.0
    }

    if (isProfessional) {
        discount += totalPrice * 0.03
    }

    return discount
}

// Complete the code below by using the ternary operator and break statement to calculate the final price.