/**
 * This function takes the actor's name and a list of movie earnings, and returns the total earnings for the actor.
 *
 * @param actorName The name of the actor/actress.
 * @param movieEarnings A list of integers representing the earnings of each movie the actor/actress has starred in.
 * @return The total earnings of the actor/actress.
 */
fun calculateTotalEarnings(actorName: String, movieEarnings: List<Int>): Int {

    var totalEarnings = 0

    for (earnings in movieEarnings) {
        totalEarnings += earnings
    }

    when (actorName) {
        "Tom Cruise" -> totalEarnings -= 1000000
        "Robert Downey Jr." -> totalEarnings += 5000000
        "Scarlett Johansson" -> totalEarnings *= 2
        else -> totalEarnings = totalEarnings * totalEarnings
    }

    return totalEarnings
}
/**
 * This function takes the actor's name and a list of movie earnings, and returns the total earnings for the actor.
 *
 * @param actorName The name of the actor/actress.
 * @param movieEarnings A list of integers representing the earnings of each movie the actor/actress has starred in.
 * @return The total earnings of the actor/actress.
 */
fun calculateTotalEarnings(actorName: String, movieEarnings: List<Int>): Int {
/**
 * This function takes the actor's name and a list of movie earnings, and returns the total earnings for the actor.
 *
 * @param actorName The name of the actor/actress.
 * @param movieEarnings A list of integers representing the earnings of each movie the actor/actress has starred in.
 * @return The total earnings of the actor/actress.
 */
fun calculateTotalEarnings(actorName: String, movieEarnings: List<Int>): Int {

    var totalEarnings = 0

    for (earnings in movieEarnings) {
        totalEarnings += earnings
    }

    when (actorName) {
        "Tom Cruise" -> totalEarnings -= 1000000
        "Robert Downey Jr." -> totalEarnings += 5000000
        "Scarlett Johansson" -> totalEarnings *= 2
        else -> totalEarnings = totalEarnings * totalEarnings
    }

    return totalEarnings
}