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...
C++ : Find the syntax errors in the following program. For each syntax error, fix it...
C++ : Find the syntax errors in the following program. For each syntax error, fix it and add a comment at the end of the line explaining what the error was. #include <iostream> #include <cmath> using namespace std; int main(){ Double a, b, c; 2=b; cout<<"Enter length of hypotenuse"<<endl; cin>>c>>endl; cout>>"Enter length of a side"<<endl; cin>>a; double intermediate = pow(c, 2)-pow(a, 2); b = sqrt(intermediate); cout<<"Length of other side is:" b<<endline; return 0; }
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...
Extract errors from the following codes & then obtain weather they are Syntax Error or Run...
Extract errors from the following codes & then obtain weather they are Syntax Error or Run Time Error? [15 pts] a) [2 pts] 1 Dim number1 As Integer 2 Dim number2 As Integer 3 Dim result As Integer 4 5 number1 = (4 * 6 ^ 4) / (10 Mod 4 – 2) 6 number2 = (16 \ 3) ^ 2 * 6 + 1 7 result = number1 - number2 Line# / Error Description /Error Type (Syntax or Runtime)...
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; }
There are logical and run time errors in the code, as well as compilation errors. **...
There are logical and run time errors in the code, as well as compilation errors. ** Your objective is get the code to run, fix any bugs in the code and ** place validation needed to prevent any memory issues. Each function has a ** description of what it does next to its prototype. ** When you find a problem, fix it in the code and note it in this header comment below. ** Please note each problem you find...
In this program, there are 3 bugs and 2 syntax errors. Please identify them! The source...
In this program, there are 3 bugs and 2 syntax errors. Please identify them! The source code is below. The source code is in C: /*------------------------------------------------------------------ File:  CylinderVolume.c  (Lab 3) Author: Gilbert Arbez, Fall 2018 Description: Calculates how the volume changes for different depths               in a horizontal cylinder. ------------------------------------------------------------------*/ #include <stdio.h> #include <stdlib.h> #include <math.h> // Define symbolic constant #define N       50    // number of points to compute #define TRUE    1 #define FALSE   0 // Prototypes void computeDisplayVolume(double, double); /*-------------------------------------------------------------------- Function: main Description:  Gets from the user...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT