Develop a pseudocode algorithm to compute gross pay. The user will input the wag
ID: 3850797 • Letter: D
Question
Develop a pseudocode algorithm to compute gross pay. The user will input the wage and how many hours a person has worked for the week. The company determines the gross pay of an individual as: pay the regular rate for all hours worked up to 40 and including 40 hours, 1.5 times the regular wage for all hours over 40 up to 54 hours, and double wage times for all hours over 54 hours. Do not calculate any taxes for the individual. Your algorithm should display the following information: The name of the worker. The amount of pay without overtime ---- Called regular pay The amount of pay for time and a half --- Called time and half earnings The amount of pay at double time. ---- Called double time earnings The total amount of pay the individual has earned for this paycheck.Explanation / Answer
Psuedocode for the Algorithm:
print "Enter the wage!"
wage = float(raw_input()) #Take input wage
print "Enter the number of hours worked in the week!"
hours = float(raw_input()) #Take input hours
total_pay = 0
without_overtime_pay = 0;
time_and_halfpay = 0;
doubletime_pay = 0;
if(hours <= 40):
without_overtime_pay = hours*wage; #calculate without_overtime_pay
total_pay = total_pay + hours*wage #calculate total_pay
elif(hours <= 54 and hours > 40):
without_overtime_pay = hours*wage; #calculate without_overtime_pay
time_and_halfpay = (hours - 40)*wage*1.5 #calculate time_and_halfpay
total_pay = total_pay + 40*wage + (hours - 40)*wage*1.5 #calculate total_pay
else:
without_overtime_pay = hours*wage; #calculate without_overtime_pay
time_and_halfpay = (14)*wage*1.5 #calculate time_and_halfpay
doubletime_pay = (hours - 54)*wage*2 #calculate
total_pay = total_pay + 40*wage + (14)*wage*1.5 + (hours - 54)*wage*2 #calculate total_pay
print "Worker Name"
print "Amount of pay without overtime ", without_overtime_pay
print "Amount of pay for time and half ", time_and_halfpay
print "Amount of pay at double time ", doubletime_pay
print "Total pay ", total_pay
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.