Question

In: Computer Science

To earn full credit, program must be free of syntax, run-time, and logic errors; include program...

To earn full credit, program must be free of syntax, run-time, and logic errors; include program comments; use reasonable readable variable names and prompts.

To include variables in the input prompt, you must use concatenation character (+). For example: assume you already asked for input of employee's first name and last name (they are stored into variables FirstName and LastName, then use this prompt to ask for employee's weekly hours which includes the employee's full name in the input statement.

Hours = float(input("Enter " + FirstName + ' ' + LastName + '\'s Weekly Hours: '))

The company which uses this program has TWO employees.

Write a Python application that will allow the user (payroll clerk) to enter payroll data for two hourly employees. Input Data includes:

  • Employee ID (string text such as AF101)
  • Employee Last Name (string text)
  • Employee First Name (string text)
  • Weekly Hours
  • Hourly pay rate per hour
  • Income tax rate

Repeat the above prompt for two employees

Must use if statements to check if the employee requires an overtime pay.

Up to 40 hours on employee’s hourly rate; any hours over 40 must be pay at a time and a half (1.5 of rate). Using , and 2 decimal places for all currency in the output

Display the followings for each employee:

  • Display Employee Data (ID, First and Last Name)
  • Display Weekly Hours and Hourly pay rate
  • Display the Gross Pay (includes overtime if any)
  • Taxes Withheld (Gross Pay x Tax Rate)
  • Net Pay (Gross Pay – Taxes Withheld)

Then finally output payroll info for the entire company (total amount for both employees)

  • Display Company payroll expense (sum of both employees’ Gross Pay)
  • Display Total Cash amount to Employees (sum of both employees’ Net Pay)

Sample input/output (user input is in bold italic)

Enter Employee’s ID (i.e. AF101): AS111

Enter Employee’s Last Name: Wong

Enter Employee’s First Name: Wanda

Enter Wanda Wong’s Weekly Hours: 36.5

Enter Wanda Wong’s Hourly pay rate per hour:  50

Enter Wanda Wong’s Income tax rate: 0.25

Enter Employee’s ID (i.e. AF101): AS256

Enter Employee’s Last Name: Johnson

Enter Employee’s First Name: Betty

Enter Betty Johnson’s Weekly Hours: 52

Enter Betty Johnson’s Hourly pay rate per hour:  30

Enter Betty Johnson’s Income tax rate: 0.20

Weekly Pay stub for AS111                       Wanda Wong

36.5 Hours Worked @ $50.00

Gross pay of                                                      $1,825.00

Less Taxes Withheld @ 25.0%                     $456.25

Net Pay                                                                  $1,368.75

Weekly Pay stub for AS256                       Betty Johnson

52 Hours Worked @ $30.00

Gross pay of                                                       $1,740.00

Less Taxes Withheld @ 20.0%                      $348.00

Net Pay                                                                   $1,392.00

Total Company payroll expense for the week: $3,565.00

Total Cash payments to Employees: $2,760.75

Solutions

Expert Solution

ids=[]
lNames=[]
fNames=[]
hours=[]
hourlyRate=[]
taxRate=[]
grossPay=[]
for i in range(0,2):
ids.append(str(input('Enter Employee’s ID (i.e. AF101): ')))
lNames.append(str(input('Enter Employee’s Last Name: ')))
fNames.append(str(input('Enter Employee’s First Name: ')))
hours.append(float(input('Enter '+fNames[i]+' '+lNames[i]+'’s Weekly Hours: ')))
hourlyRate.append(float(input('Enter '+fNames[i]+' '+lNames[i]+'’s Hourly pay rate per hour: ')))
taxRate.append(float(input('Enter '+fNames[i]+' '+lNames[i]+'’s Income tax rate: ')))
  
for i in range(0,2):
print('Weekly Pay stub for '+ids[i]+' '+fNames[i]+' '+lNames[i])
print('{0:.1f}'.format(hours[i])+' Hours Worked @ $'+'{0:.2f}'.format(hourlyRate[i]))
if(hours[i]>40):
grossPay.append(hourlyRate[i]*40+hourlyRate[i]*(hours[i]-40)*1.5)
else:
grossPay.append(hourlyRate[i]*hours[i])
print('Gross pay of $'+'{0:.2f}'.format(grossPay[i]))
print('Less Taxes Withheld @ {0:.2f}%'.format(taxRate[i]*100)+' ${0:.2f}'.format(grossPay[i]*taxRate[i]))
print('Net Pay ${0:.2f}'.format(grossPay[i]-grossPay[i] *taxRate[i]))

print('Total Company payroll expense for the week: ${0:.2f}'.format(grossPay[0]+grossPay[1]))
print('Total Cash payments to Employees: ${0:.2f}'.format(((grossPay[0]-grossPay[0]*taxRate[0])+(grossPay[1]-grossPay[1]*taxRate[1]))))


Related Solutions

The files provided in the code editor to the right contain syntax and/or logic errors. In...
The files provided in the code editor to the right contain syntax and/or logic errors. In each case, determine and fix the problem, remove all syntax and coding errors, and run the program to ensure it works properly. DebugBox.java public class DebugBox { private int width; private int length; private int height; public DebugBox() { length = 1; width = 1; height = 1; } public DebugBox(int width, int length, height) { width = width; length = length; height =...
The files provided in the code editor to the right contain syntax and/or logic errors. In...
The files provided in the code editor to the right contain syntax and/or logic errors. In each case, determine and fix the problem, remove all syntax and coding errors, and run the program to ensure it works properly. Please Fix code and make Copy/Paste avaliable // Application allows user to enter a series of words // and displays them in reverse order import java.util.*; public class DebugEight4 {    public static void main(String[] args)    {       Scanner input = new Scanner(System.in);       int...
The coding for this program to run as described on Python: Your (turtle) program must include:...
The coding for this program to run as described on Python: Your (turtle) program must include: include import turtle on a line after the comments so you can use the various Turtle-related objects and methods. Create a turtle named after your favorite ice cream flavor. Make sure the name has no punctuation and consists only of letters, numbers and the underscore character. Write your python program so your turtle is constantly moving and can be turned left and right using...
Each of the following files in the Chapter15 folder of your downloadable student files has syntax and/or logic errors.
Each of the following files in the Chapter15 folder of your downloadable student files has syntax and/or logic errors. In each case, determine the problem and fix the program. After you correct the errors, save each file using the same filename preceded with Fix. For example, DebugFifteen1.java will become FixDebugFifteen1.java. a. DebugFifteen1.java b. DebugFifteen2.java c. DebugFifteen3.java d. DebugFifteen4.java    
The following code segment which uses pointers may contain logic and syntax errors. Find and correct...
The following code segment which uses pointers may contain logic and syntax errors. Find and correct them. a) Returns the sum of all the elements in summands int sum(int* values) { int sum = 0; for (int i = 0; i < sizeof(values); i++) sum += *(values + i); return sum; } b) Overwrites an input string src with "61C is awesome!" if there's room. Does nothing if there is not. Assume that length correctly represents the length of src....
Analyze following program and Find Syntax errors. #include<iostream> int show(int x) int main() {     int A,B;...
Analyze following program and Find Syntax errors. #include<iostream> int show(int x) int main() {     int A,B;       char B=10; cout<<”Enter Value of A”; cin<<A; show(A) show(50)          }       cin.get(); } int show(int x); { cout<<”Value is =” <<X cout<<endl; }
To receive full credit for any answer, you must explain your answers and include a logical...
To receive full credit for any answer, you must explain your answers and include a logical and correct application of physics principles and/or definitions in your explanation. If there is a mathmatecal solution or drawing to help understand the problem please include 1.    To compute the pressure difference between two points in a fluid, you must add the pressure differences determined from Bernoulli’s equation and Poiseuille’s law. a) Give an example of an actual situation where Bernoulli’s equation can be...
. YOU MUST SHOW ALL CALCULATIONS TO EARN CREDIT.                                   &nbsp
. YOU MUST SHOW ALL CALCULATIONS TO EARN CREDIT.                                                                         2016                            2017 BALANCE SHEETS: Assets:                         Cash                                        120,000                       160,000                         Accounts Receivable               520,000                       620,000                         Inventory                                305,000                       290,000                         Fixed Assets, net                    410,000                       510,000                         Total Assets                           1,355,000                    1,580,000 Liabilities and Equity:                         Accounts Payable                   350,000                       $375,000                         Long-term Debt                      500,000                       625,000                         Common Stock                       50,000                         75,000                         Retained Earnings                   455,000                       505,000                         Total Liabilities and Equity    1,355,000                   ...
Google search images and find the graphs for a perfectly competitive firm. To earn full credit...
Google search images and find the graphs for a perfectly competitive firm. To earn full credit your graphs must include the following specific graphs: Find the graph for short run economic loss for the firm. Find the graph for short run economic profit for the firm. Find the graph for long run – normal profit for the firm. Make sure the graphs show the area of economic profit or loss.
A. Draw a short run Philips curve. Label it in full, and include it in your...
A. Draw a short run Philips curve. Label it in full, and include it in your email, as an attachment with your exam. Explain the reasons that underlie the short run cause and effect relationship, as originally stated by A. W. Philips. B. How is the short run Philips curve being used today (2020) in the USA? Give one example of the method being practiced today. What is the expected gain?   C. Some countries have had Philips curve results completely...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT