/**
 * A musician wants to calculate their average weekly pay.
 * In this exercise, you need to divide the musician's annual salary by the number of weeks they worked in order to find the average weekly pay.
 * The quotient will be stored in the variable 'averagePay'.
 *
 * @param annualSalary The musician's annual salary in dollars.
 * @param weeksWorked The number of weeks the musician worked.
 * @return The average pay per week rounded to two decimal places.
 */
fun calculatePay(annualSalary: Double, weeksWorked: Int): Double {

    val averagePay = annualSalary / weeksWorked  // Divide the musician's annual salary by the number of weeks worked to calculate the average weekly pay
    return averagePay.round(2)  // Return the average pay rounded to two decimal places
}

fun Double.round(decimals: Int): Double = "%.${decimals}f".format(this).toDouble()
/**
 * A musician wants to calculate their average weekly pay.
 * In this exercise, you need to divide the musician's annual salary by the number of weeks they worked in order to find the average weekly pay.
 * The quotient will be stored in the variable 'averagePay'.
 *
 * @param annualSalary The musician's annual salary in dollars.
 * @param weeksWorked The number of weeks the musician worked.
 * @return The average pay per week rounded to two decimal places.
 */
fun calculatePay(annualSalary: Double, weeksWorked: Int): Double {
/**
 * A musician wants to calculate their average weekly pay.
 * In this exercise, you need to divide the musician's annual salary by the number of weeks they worked in order to find the average weekly pay.
 * The quotient will be stored in the variable 'averagePay'.
 *
 * @param annualSalary The musician's annual salary in dollars.
 * @param weeksWorked The number of weeks the musician worked.
 * @return The average pay per week rounded to two decimal places.
 */
fun calculatePay(annualSalary: Double, weeksWorked: Int): Double {

    val averagePay = annualSalary / weeksWorked  // Divide the musician's annual salary by the number of weeks worked to calculate the average weekly pay
    return averagePay.round(2)  // Return the average pay rounded to two decimal places
}

fun Double.round(decimals: Int): Double = "%.${decimals}f".format(this).toDouble()