0% found this document useful (0 votes)
8 views2 pages

Calculate Gross Pay and Bonuses

The document contains two Python programs: the first calculates gross pay based on hours worked and hourly rate, applying overtime for hours over 40. The second program computes an employee's total salary including a bonus based on their monthly salary range. Both programs prompt the user for input and display the calculated results.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views2 pages

Calculate Gross Pay and Bonuses

The document contains two Python programs: the first calculates gross pay based on hours worked and hourly rate, applying overtime for hours over 40. The second program computes an employee's total salary including a bonus based on their monthly salary range. Both programs prompt the user for input and display the calculated results.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

2.

a)Write a program to prompt the user for hours and rate per hour using input to compute gross
pay. Pay the hourly rate for the hours up to 40 and 1.5 times the hourly rate for all hours worked
above 40 hours# Prompt the user for hours worked

hours_input = input("Enter Hours: ")

rate_input = input("Enter Rate per Hour: ")

hours = float(hours_input)

rate = float(rate_input)

if( hours <= 40):

pay = hours * rate

else:

regular_pay = 40 * rate

overtime_pay = (hours - 40) * (rate * 1.5)

pay = regular_pay + overtime_pay

print("Gross Pay:", pay)

output

Enter Total Hours at Workplace: 50

Enter Sleep Hours (unpaid): 5

Enter Hourly Rate: 10.50

[Link] code to calculate employ pay sleeb

Salary Range (Monthly) Bonus (%)


≤ 10,000 20%
10,001 – 20,000 15%
20,001 – 30,000 10%
> 30,000 5%

salary_input = input("Enter employee's monthly salary: ")

salary = float(salary_input)

if (salary <= 10000):


bonus_percent = 20

elif (salary <= 20000):

bonus_percent = 15

elif( salary <= 30000):

bonus_percent = 10

else:

bonus_percent = 5

bonus = (bonus_percent / 100) * salary

total_salary = salary + bonus

print("Base Salary :", salary)

print("Bonus Percentage :", bonus_percent, "%")

print("Bonus Amount :", bonus)

print("Total Salary :", total_salary)

output

Enter employee's monthly salary: 18000

Base Salary : 18000.0

Bonus Percentage : 15 %

Bonus Amount : 2700.0

Total Salary : 20700.0

You might also like