First_Shift = 17 Second_Shift = 18.5 Third_Shift = 22 hours = float(input('How many hours did you work: ')); shift = int(input("Which shift did you work: 1, 2 or 3. ")); if hours > 40: overtimeHours = hours - 40 if shift == 1: if hours > 40: regularPay = First_Shift * 40 overtimePay = overtimeHours * (First_Shift * 1.5) else: regularPay = First_Shift * hours grossPay = regularPay + overtimePay netPay = grossPay print('You have worked ', hours); print('You were on shift ', shift); print('You earned an hourly wage of ', First_Shift, 'dollars per hour.'); print('Your regular pay is ', regularPay); print('Your overtime pay is', overtimePay); print('Your total pay is ', netPay); if shift == 2: retirement = input('Do you want to participate in the retirement plan ("Y" for Yes)? '); if hours > 40: regularPay = Second_Shift * 40 overtimePay = overtimeHours * (Second_Shift * 1.5) else: regularPay = Second_Shift * hours grossPay = regularPay + overtimePay if retirement == 'Y' or retirement == 'y': deduction = grossPay * 0.03 netPay = grossPay - deduction print('You have worked ', hours); print('You were on shift ', shift); print('You earned an hourly wage of ', Second_Shift, 'dollars per hour.'); print('Your regular pay is ', regularPay); print('Your overtime pay is', overtimePay); print('Your total pay before deductions is ', grossPay); print('Your total pay after deductions is ', netPay); if shift == 3: retirement = input('Do you want to participate in the retirement plan ("Y" for Yes)? '); if hours > 40: regularPay = Third_Shift * 40 overtimePay = overtimeHours * (Third_Shift * 1.5) else: regularPay = Third_Shift * hours grossPay = regularPay + overtimePay if retirement == 'Y' or retirement == 'y': deduction = grossPay * 0.03 netPay = grossPay - deduction print('You have worked ', hours); print('You were on shift ', shift); print('You earned an hourly wage of ', Third_Shift, 'dollars per hour.'); print('Your regular pay is ', regularPay); print('Your overtime pay is', overtimePay); print('Your total pay before deductions is ', grossPay); print('Your total pay after deductions is ', netPay); if shift < 0 or shift > 3: print('Invalid shift.');
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy. Accept Learn more