/**
 * A lawyer handles multiple cases and works a certain number of hours per day.
 * You need to calculate the total hours the lawyer has worked over the given number of days.
 * Each day, the lawyer may handle different cases and can work overtime.
 *
 * @param hoursPerDay The number of hours the lawyer works per day.
 * @param days The total number of days.
 * @return The total hours the lawyer has worked over the given number of days.
 */
fun calculateTotalHours(hoursPerDay: Int, days: Int): Int {

    var totalHours = 0
    var index = 0

    while (index < days) {
        println("Day ${index + 1}:")
        print("Enter the number of cases handled today: ")
        var casesHandled = readLine()!!.toInt()
        print("Enter the number of overtime hours worked today: ")
        var overtimeHours = readLine()!!.toInt()

        while (casesHandled < 0 || overtimeHours < 0) {
            println("Invalid input! Please enter positive values.")
            print("Enter the number of cases handled today: ")
            casesHandled = readLine()!!.toInt()
            print("Enter the number of overtime hours worked today: ")
            overtimeHours = readLine()!!.toInt()
        }

        // Calculate total hours worked for the day
        val hoursWorked = hoursPerDay + overtimeHours
        totalHours += hoursWorked

        index++
    }

    return totalHours
}
/**
 * A lawyer handles multiple cases and works a certain number of hours per day.
 * You need to calculate the total hours the lawyer has worked over the given number of days.
 * Each day, the lawyer may handle different cases and can work overtime.
 *
 * @param hoursPerDay The number of hours the lawyer works per day.
 * @param days The total number of days.
 * @return The total hours the lawyer has worked over the given number of days.
 */
fun calculateTotalHours(hoursPerDay: Int, days: Int): Int {
/**
 * A lawyer handles multiple cases and works a certain number of hours per day.
 * You need to calculate the total hours the lawyer has worked over the given number of days.
 * Each day, the lawyer may handle different cases and can work overtime.
 *
 * @param hoursPerDay The number of hours the lawyer works per day.
 * @param days The total number of days.
 * @return The total hours the lawyer has worked over the given number of days.
 */
fun calculateTotalHours(hoursPerDay: Int, days: Int): Int {

    var totalHours = 0
    var index = 0

    while (index < days) {
        println("Day ${index + 1}:")
        print("Enter the number of cases handled today: ")
        var casesHandled = readLine()!!.toInt()
        print("Enter the number of overtime hours worked today: ")
        var overtimeHours = readLine()!!.toInt()

        while (casesHandled < 0 || overtimeHours < 0) {
            println("Invalid input! Please enter positive values.")
            print("Enter the number of cases handled today: ")
            casesHandled = readLine()!!.toInt()
            print("Enter the number of overtime hours worked today: ")
            overtimeHours = readLine()!!.toInt()
        }

        // Calculate total hours worked for the day
        val hoursWorked = hoursPerDay + overtimeHours
        totalHours += hoursWorked

        index++
    }

    return totalHours
}