The above video helps you out in making overtime calculator using python
Checkout the video for detailed explanation of the code
Before working on it, let us know how overtime calculator exactly works
What is Overtime?
Overtime is an employee’s working hours beyond normal working hours.
Although the general definition of overtime only refers to working hours outside the standard working hours, it usually refers to the remuneration paid by employees for the work. Salary varies from company to company and depends on overtime details, such as the number of hours worked and multiplier.
Standard overtime pay includes one and a half and double time
Formulas for Overtime Pay:
There are several formulas available for computing the overtime payment.If you need to calculate the hourly overtime pay, then you need to multiple hourly regular pays with a multiplier as:
HOP = m * HRP
Where,
HOP = Hourly overtime payment
m = multiplier (usually 1.5)
HRP = Hourly regular payment
You should have an exact figure of your hourly overtime to find total overtime precisely:
OP = n * HOP
Where,
OP = Overtime pay
n = number of overtime hours per month
Now, If you want to calculate the total salary of the month, then you need to add overtime pay to your regular salary:
TP = RP + OP
Where,
TP = Total pay
RP = regular pay
It is time to work on the code to build overtime calculator
Source Code:
name = input('What is your name? ')
m = 1.5
regular_working_hours = int(input("How many hours do you work per month? "))
n = int(input("How many overtime hours did you work this month?: "))
regular_payment_per_hour = float(input("How much is your hourly wage? "))
overtime_payment_per_hour = m * regular_payment_per_hour
total_overtime_payment = n * overtime_payment_per_hour
total_regular_payment = regular_payment_per_hour * regular_working_hours
total_salary = total_regular_payment + total_overtime_payment
print("\n ----------------------------- Here's your result! ---------------------------")
print('Name: ' + name)
print('Overtime payment per hour: ${:,.2f} per hour'.format(overtime_payment_per_hour))
print('Total overtime payment:${:,.2f} a month'.format(total_overtime_payment))
print('Total Regular payment:${:,.2f} a month'.format(total_regular_payment))
print('Total payment:${:,.2f} a month'.format(total_salary))
Copyright Notice: Unless otherwise indicated, all articles are original to this site, and reproduction must cite the source
Article link:http://pybeginners.com/article/how-to-make-an-overtime-calculator-using-python/