Answer to Question #278888 in Python for guiahara

Question #278888
  • Ask the user to enter the name of the employee.
  • Prompt the user to select between full time and part time by pressing either F (full time) or P
  • (part time)
  • If F is pressed, ask the user to enter his monthly salary. Then display his name and salary.
  • If P is pressed, ask the user to type his rate (pay) per hour, the number of hours he worked, and the numbers of overtime.
  • Then display his name and wage. The computation of overtime pay is: ℎ × ( ℎ × 125%)
  • If an invalid letter is pressed, display an error message.
1
Expert's answer
2021-12-12T12:18:53-0500
employeeName=input("Enter employee name: ")
employeeType=input("Press F for Full Time or p for Part Time: ")
if employeeType.lower()=="p":
    print("---Part Time Employee---")
    ratePerHour=float(input("Enter rate per hour: "))
    hoursWorked=float(input("Enter no. of hours worked: "))
    overtime=float(input("Enter no. of overtime: "))
    basicPay=ratePerHour*hoursWorked
    overtimePay=overtime* (ratePerHour * 125.0/100.0)
    grossPay=basicPay+overtimePay
    print("-----------------------------")
    print(f"Employee Name: {employeeName}")
    print(f"Basic Pay: {basicPay}")
    print(f"Overtime Pay: {overtimePay}")
    print("-----------------------------")
    print(f"Gross Pay: {grossPay}")
elif employeeType.lower()=="f":
    print("---Full Time Employee---")
    monthlySalary=float(input("Enter monthly salary: "))
    print("-----------------------------")
    print(f"Employee Name: {employeeName}")
    print(f"Basic Pay: {monthlySalary}")
    print("-----------------------------")
    print(f"Gross Pay: {monthlySalary}")
else:
    print("Invalid input")



Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS