/**
 * A graphic designer wants to calculate his/her hourly rate for a project based on the total hours worked and the desired hourly rate.
 * Complete the function below to calculate the hourly rate by dividing the project fee, which is the product of hoursWorked and hourlyRate, by the total hours worked.
 *
 * @param hoursWorked Total hours worked on the project.
 * @param hourlyRate Desired hourly rate for the project.
 * @return Hourly rate to be charged for the project.
 */
fun calculateHourlyRate(hoursWorked: Int, hourlyRate: Float): Float {

    val projectFee = hoursWorked * hourlyRate

    // Handle division by zero when hoursWorked is zero
    if (hoursWorked == 0) {
        return 0f
    }

    // Check if the hourly rate is negative or zero
    if (hourlyRate <= 0) {
        return "Invalid hourly rate!".toFloat()
    }

    // Check if project fee is positive before calculating the hourly rate
    return if (projectFee > 0) {
        projectFee / hoursWorked
    } else {
        hourlyRate
    }
}
/**
 * A graphic designer wants to calculate his/her hourly rate for a project based on the total hours worked and the desired hourly rate.
 * Complete the function below to calculate the hourly rate by dividing the project fee, which is the product of hoursWorked and hourlyRate, by the total hours worked.
 *
 * @param hoursWorked Total hours worked on the project.
 * @param hourlyRate Desired hourly rate for the project.
 * @return Hourly rate to be charged for the project.
 */
fun calculateHourlyRate(hoursWorked: Int, hourlyRate: Float): Float {
/**
 * A graphic designer wants to calculate his/her hourly rate for a project based on the total hours worked and the desired hourly rate.
 * Complete the function below to calculate the hourly rate by dividing the project fee, which is the product of hoursWorked and hourlyRate, by the total hours worked.
 *
 * @param hoursWorked Total hours worked on the project.
 * @param hourlyRate Desired hourly rate for the project.
 * @return Hourly rate to be charged for the project.
 */
fun calculateHourlyRate(hoursWorked: Int, hourlyRate: Float): Float {

    val projectFee = hoursWorked * hourlyRate

    // Handle division by zero when hoursWorked is zero
    if (hoursWorked == 0) {
        return 0f
    }

    // Check if the hourly rate is negative or zero
    if (hourlyRate <= 0) {
        return "Invalid hourly rate!".toFloat()
    }

    // Check if project fee is positive before calculating the hourly rate
    return if (projectFee > 0) {
        projectFee / hoursWorked
    } else {
        hourlyRate
    }
}