Question

How to write a Python program to solve a simple payroll calculation?  Calculate the amount of pay,...

How to write a Python program to solve a simple payroll calculation?  Calculate the amount of pay, given hours worked, and hourly rate.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

hours = float(input("Hours Worked: "))
rate = float(input("Hourly Rate of Pay: "))
pay = 0
if hours > 40:
    pay = (40 * rate) + ((hours - 40) * 1.5 * rate)
else:
    pay = hours * rate
print("Total Gross Pay: $%.2f"%pay)


hours = float(input("Hours Worked: "))
rate = float(input("Hourly Rate of Pay: "))
pay = hours * rate
print("Total Gross Pay: $%.2f"%pay)

Add a comment
Know the answer?
Add Answer to:
How to write a Python program to solve a simple payroll calculation?  Calculate the amount of pay,...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 1.) Write a code in Python to Calculate weekly pay with overtime for an hourly employee...

    1.) Write a code in Python to Calculate weekly pay with overtime for an hourly employee (if number of hours exceed 40, then the hourly rate goes up by 50% of the usual hourly rate; the user will provide the hourly rate and the number of hours worked)

  • write a program that reads the following information and prints a payroll statement Employees name (Smith)...

    write a program that reads the following information and prints a payroll statement Employees name (Smith) number of hours worked in a week(e.g.,10) hourly pay rate (e.g.,9.75) federal tax withholding (e.g. ,20%) state tax withholding (e.g., 9%) in python

  • Create a dual-alternative selection structure using Python: A company ABC asked you to design a simple...

    Create a dual-alternative selection structure using Python: A company ABC asked you to design a simple payroll program that calculates and employee's weekly gross pay, including any overtime wages. If employees work over 40 hours in a week, they will get 1.5 times of their regular hourly rate for all hours over 40. Your program asks the user to input hours worked for a week, regular hourly rate, and then display the weekly gross pay Output sample Enter weekly hours...

  • You are to write a program that will process employees and their pay. For each employee...

    You are to write a program that will process employees and their pay. For each employee the program will read in an employee’s name and hourly pay rate. It should also read in the number of hours worked each day for 5 days and calculate his or her total number of hours worked. You must read the hours using a loop. The program should output the employee’s name, gross pay, total withholding amount and net pay. Withholding is made up...

  • NOT: Please explain how you solve it, and what formula you use Calculate Payroll Breakin Away...

    NOT: Please explain how you solve it, and what formula you use Calculate Payroll Breakin Away Company has three employees a consultant, a computer programmer, and an administrator. The following payroll information is available for each employee: Consultant Computer Programmer Administrator Regular earnings rate $3,110 per week $32 per hour $42 per hour Not applicable 1.5 times hourly rate 2 times hourly rate Overtime earnings rate Number of withholding allowances For the current pay period, the computer programmer worked 60...

  • The Payroll Department keeps a list of employee information for each pay period in a text...

    The Payroll Department keeps a list of employee information for each pay period in a text file. The format of each line of the file is the following: <last name> <hourly wage> <hours worked> Write a program that inputs a filename from the user and prints to the terminal a report of the wages paid to the employees for the given period. The report should be in tabular format with the appropriate header. Each line should contain: An employee’s name...

  • Data Programming l: PYTHON 1. Write a program that computes your gross pay. Your code should...

    Data Programming l: PYTHON 1. Write a program that computes your gross pay. Your code should get two numbers: hours and rate per hour. You should give the employee 1.75 times the hourly rate for hours worked above 40 hours. Output: Your gross pay is $487.5 2. Rewrite the previous program using try and except so that your program handles non-numeric inputs gracefully by printing a message and exiting the program. The following shows two executions of the program with...

  • write the code in python programming that will read in the following from the user. Hourly...

    write the code in python programming that will read in the following from the user. Hourly Pay Rate, Hours Worked. if both values read in are positive, calculate the net pay. To calculate the net pay, first calculate the gross pay.the gross pay is the hours worked times the hourly rate. Next calculate the taxes. tax the first$300 dollars at 15% tax the next $150 at 20% tax the rest at 25% the net pay is equal to the gross...

  • Program description: Write the necessary C++ statements (Program) to calculate the employee's weekly pay. Where :...

    Program description: Write the necessary C++ statements (Program) to calculate the employee's weekly pay. Where : Hour = employee's work hours Rate = employee's hourly pay Wages = employee's weekly pay Given that ( Hour= 31.5 and , Rate = $11.45) Write the variable declarations and initialization sections necessary to compute and print the required calculations. The program should ask the user to input the hours and Rate of pay, then calculate the weekly Wages. Hint: Modify program in project...

  • I need to see the program in C++: You are to write a payroll application for...

    I need to see the program in C++: You are to write a payroll application for a company. You should prompt the user to input two values in the following order. 1. The number of hours they worked. Our company only pays employees for full hours of work and do not count partial hours. Employees are not allowed to round up the time worked. So, 5 would be a valid input, but 5.7 would not be. 2. The hourly rate...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT