Program calculates wages for laborers based on the number of hours they have worked

Accept the name of the laborer and the number of hours worked. Calculate and display the wages. The program should run for N number of laborers as specified by the user.

This program calculates wages for laborers based on the number of hours they have worked. It prompts the user to enter the total number of laborers, their names, and the number of hours each laborer has worked. Then, it calculates the wages according to predefined rates and displays the result.

N = int(input('Enter total number of employees you want to calculate wages for: '))
i = 1
while i <= N:
    name = input('Enter Your Name: ')
    working_hours = int(input('Enter Your Working Hours: '))
    initial_wage = 100
    total_hours = total_wage = 0
    
    if working_hours <= 8:
        total_wage = initial_wage
    elif 8 < working_hours <= 12:
        total_hours = working_hours - 8
        total_wage = initial_wage + (total_hours * 30)
    elif 12 < working_hours <= 16:
        total_hours = working_hours - 12
        total_wage = initial_wage + (4 * 30) + (total_hours * 40)
    elif 16 < working_hours <= 20:
        total_hours = working_hours - 16
        total_wage = initial_wage + (4 * 30) + (4 * 40) + (total_hours * 50)
    else:
        total_hours = working_hours - 20
        total_wage = initial_wage + (4 * 30) + (4 * 40) + (4 * 50) + (total_hours * 60)
    
    i += 1
    print('The today wage of Mr.', name, 'is:', total_wage, 'Rs\n')
Output : 
Enter total number of employees you want to calculate wages for: 2
Enter Your Name: John
Enter Your Working Hours: 8
The today wage of Mr. John is: 100 Rs

Enter Your Name: Alice
Enter Your Working Hours: 14
The today wage of Mr. Alice is: 520 Rs

Leave a Reply

Your email address will not be published. Required fields are marked *