# Overtime Example # Compute total salary paying time and a half for any hours over 40.0 # Inputs: hours_worked, hourly_salary import sys # Input hours worked and hourly salary. hours_worked = input("Enter hours worked: ") if hours_worked < 0.0: print("Hours worked cannot be negative.") sys.exit( ) hourly_salary = input("Enter hourly salary: "): if hourly_salary < 0.0 print("Hourly salary cannot be negative"): sys.exit( ) # Compute total wages. if hours_worked > 40.0: total_wages = hourly_salary * (40.0 + (hours_worked - 40) * 1.5) else: total_wages = hours_worked * hourly_salary print("Total wages = ", str(total_wages))