/**
 * A carpenter is paid a certain rate per hour for the number of hours worked. However, if the carpenter works
 * for more than 40 hours in a week, they are entitled to overtime pay at 1.5 times their regular rate.
 *
 * Given the number of hours worked and the regular rate per hour, calculate the total pay for the carpenter,
 * considering overtime if applicable.
 *
 * @param hoursWorked The number of hours worked by the carpenter.
 * @param ratePerHour The regular rate per hour for the carpenter.
 * @return The total pay for the carpenter.
 */
fun calculateCarpenterPay(hoursWorked: Int, ratePerHour: Double): Double {

    var totalPay: Double

    // Check if the carpenter worked overtime
    totalPay = if (hoursWorked > 40) {
        val overtimeHours = hoursWorked - 40
        val overtimePay = ratePerHour * 1.5 * overtimeHours

        // Calculate total pay including overtime
        ratePerHour * 40 + overtimePay
    } else {
        // Calculate total pay without overtime
        ratePerHour * hoursWorked
    }

    return totalPay
}
/**
 * A carpenter is paid a certain rate per hour for the number of hours worked. However, if the carpenter works
 * for more than 40 hours in a week, they are entitled to overtime pay at 1.5 times their regular rate.
 *
 * Given the number of hours worked and the regular rate per hour, calculate the total pay for the carpenter,
 * considering overtime if applicable.
 *
 * @param hoursWorked The number of hours worked by the carpenter.
 * @param ratePerHour The regular rate per hour for the carpenter.
 * @return The total pay for the carpenter.
 */
fun calculateCarpenterPay(hoursWorked: Int, ratePerHour: Double): Double {
/**
 * A carpenter is paid a certain rate per hour for the number of hours worked. However, if the carpenter works
 * for more than 40 hours in a week, they are entitled to overtime pay at 1.5 times their regular rate.
 *
 * Given the number of hours worked and the regular rate per hour, calculate the total pay for the carpenter,
 * considering overtime if applicable.
 *
 * @param hoursWorked The number of hours worked by the carpenter.
 * @param ratePerHour The regular rate per hour for the carpenter.
 * @return The total pay for the carpenter.
 */
fun calculateCarpenterPay(hoursWorked: Int, ratePerHour: Double): Double {

    var totalPay: Double

    // Check if the carpenter worked overtime
    totalPay = if (hoursWorked > 40) {
        val overtimeHours = hoursWorked - 40
        val overtimePay = ratePerHour * 1.5 * overtimeHours

        // Calculate total pay including overtime
        ratePerHour * 40 + overtimePay
    } else {
        // Calculate total pay without overtime
        ratePerHour * hoursWorked
    }

    return totalPay
}