Python program to calculate gross pay (Hourly paid employee)

Here, we are writing a Python program in which we will calculate the total payments made to the employee per day based on the hours worked.
Submitted by Shivang Yadav, on March 01, 2021

The payments made to the employee are based on the hours he has worked. Ideal working hours per day is 8 hours and for that 1500 is paid to the employee.

The calculation of salary based on hours worked is,

  • Hours worked = 8, payment = 1500.
  • Hours worked < 8, pay less, 75 per hour.
  • Hours worked > 8, pay more, 75 per hour.

Python program to calculate gross pay

workingHours = int(input("Enter Working Hours: "))

if(workingHours == 8):
    print("1500")
elif(workingHours >= 1 and workingHours < 8):
    lessHours = 8 - workingHours
    lessPay = ((1500*5)/100)*lessHours
    totalPay = 1500 - lessPay
    
    print("Less Hours:",lessHours)
    print("Less Payment:", lessPay)
    print("Total:",totalPay)
elif(workingHours > 8 and workingHours <= 14):
    extraHours = workingHours - 8
    extraPay = ((1500*5)/100)*extraHours
    totalPay=1500 + extraPay
    
    print("Extra Hours:",extraHours)
    print("Extra Payment:", extraPay)
    print("Total:",totalPay)
else:
    print("Invalid Hours...")

Output:

Enter Working Hours: 12
Extra Hours: 4
Extra Payment: 300.0
Total: 1800.0

Python Basic Programs »





Comments and Discussions




Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.