/**
 * This function calculates the payroll for a list of artists using a while loop.
 *
 * @param artists A list of dictionaries representing the artists, with the following keys:
 *                - "name" : String (name of the artist)
 *                - "hours_worked" : Double (number of hours worked)
 *                - "hourly_pay" : Double (hourly pay rate)
 * @return The total payroll amount for all artists in the list.
 */
fun calculatePayroll(artists: List<Map<String, Any>>): Double {

    var totalPayroll = 0.0
    var index = 0

    while (index < artists.size) {
        val artist = artists[index]

        // Complete the following line of code to calculate the pay for each artist.
        // Pay = hours_worked * hourly_pay
        val pay = artist["hours_worked"] as Double * artist["hourly_pay"] as Double

        // Add the pay to the total payroll
        totalPayroll += pay

        // Increment the index to move to the next artist in the list
        index++
    }

    return totalPayroll
}
/**
 * This function calculates the payroll for a list of artists using a while loop.
 *
 * @param artists A list of dictionaries representing the artists, with the following keys:
 *                - "name" : String (name of the artist)
 *                - "hours_worked" : Double (number of hours worked)
 *                - "hourly_pay" : Double (hourly pay rate)
 * @return The total payroll amount for all artists in the list.
 */
fun calculatePayroll(artists: List<Map<String, Any>>): Double {
/**
 * This function calculates the payroll for a list of artists using a while loop.
 *
 * @param artists A list of dictionaries representing the artists, with the following keys:
 *                - "name" : String (name of the artist)
 *                - "hours_worked" : Double (number of hours worked)
 *                - "hourly_pay" : Double (hourly pay rate)
 * @return The total payroll amount for all artists in the list.
 */
fun calculatePayroll(artists: List<Map<String, Any>>): Double {

    var totalPayroll = 0.0
    var index = 0

    while (index < artists.size) {
        val artist = artists[index]

        // Complete the following line of code to calculate the pay for each artist.
        // Pay = hours_worked * hourly_pay
        val pay = artist["hours_worked"] as Double * artist["hourly_pay"] as Double

        // Add the pay to the total payroll
        totalPayroll += pay

        // Increment the index to move to the next artist in the list
        index++
    }

    return totalPayroll
}