Question

In: Computer Science

To include variables in the input prompt, you must use concatenation character (+). For example: assume...

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

def calculation(hours,rate,taxrate):
    list=[]
    if(hours>40):
        extrahours=hours-40
        hours=hours-extrahours
        extrapay=extrahours*(rate*1.5)
        grosspay=(hours*rate)+extrapay
        tax=grosspay*taxrate
        netpay=grosspay-tax
        list.append(grosspay)
        list.append(tax)
        list.append(netpay)
    else:
        grosspay=hours*rate
        tax=grosspay*taxrate
        netpay=grosspay-tax
        list.append(grosspay)
        list.append(tax)
        list.append(netpay)
    return list
def employeedetails():
    details=[]
    id=input("Enter Employee's ID(i.eAF101):")
    lname=input("Enter Employee's Last Name:")
    fname=input("Enter Employee's First Name:")
    hours=float(input("Enter "+fname+' '+lname+'\'s Weekly Hours:'))
    rate=float(input("Enter "+fname+' '+lname+'\'s Hourly pay rate per hour:'))
    taxrate=float(input("Enter "+fname+' '+lname+'\'s Income tax rate:'))
    details.append(id)
    details.append(lname)
    details.append(fname)
    details.append(hours)
    details.append(rate)
    details.append(taxrate)
    return details

def printmethod(id,fname,lname,hours,rate,grosspay,taxrate,tax,netpay):
    print("Weekly Pay stub for "+id)
    print(fname+' '+lname)
    print(str(hours)+' Hours Worked @ ${:,.2f}'.format(rate))
    print('Gross pay of ${:,.2f}'.format(grosspay))
    print('Less Taxes Withheld @ '+str(taxrate*100)+'%')
    print('${:,.2f}'.format(tax))
    print('Net Pay ${:,.2f}'.format(netpay))



emp1details=employeedetails();

emp2details=employeedetails();

emp1=calculation(emp1details[3],emp1details[4],emp1details[5])
emp2=calculation(emp2details[3],emp2details[4],emp2details[5])

printmethod(emp1details[0],emp1details[2],emp1details[1],emp1details[3],emp1details[4],emp1[0],emp1details[5],emp1[1],emp1[2])
printmethod(emp2details[0],emp2details[2],emp2details[1],emp2details[3],emp2details[4],emp2[0],emp2details[5],emp2[1],emp2[2])

print('Total Company payroll expense for the week: ${:,.2f}'.format(emp1[0]+emp2[0]))
print('Total Cash Payment to Employees: ${:,.2f}'.format(emp1[2]+emp2[2]))

below are the code pics in the ide for reference like indentation

Below is the Screen shot of output of the program


Related Solutions

convert this program that is for string into character input data #include "stdafx.h" #include <string.h> #include...
convert this program that is for string into character input data #include "stdafx.h" #include <string.h> #include <stdlib.h> unsigned int putIntoHashTable(char *ptrInputData, unsigned int bufferLength); // function to add to hash table unsigned int getFromHashTable(char *ptrOutputData, unsigned int bufferLength); // function to retrieve data from hash table #define INPUT_BUFFER_SIZE 200 // local buffer used for adding data to the hash table (there is no reason in this assignment to change this value) #define HASH_SIZE 100 // size of hash table to...
Use C language Write a program that reads in a series of lines of input character...
Use C language Write a program that reads in a series of lines of input character by character (using getchar()). The first line of the input contains an integer which specifies the number of remaining lines of input, each of which contains a floating point number. The integer value on the first line can be read with scanf(), but all of the following lines can only be read with getchar(). Each line after the first contains a single floating point...
Prompt: Use the discussion to demonstrate what you learned about Litigation and ADR . Assume you...
Prompt: Use the discussion to demonstrate what you learned about Litigation and ADR . Assume you are the HR representative for a large company. Company policy dictates Alternative Dispute Resolution must be used before any court proceedings. Discuss what type of ADR you would use for the following situations: Sexual harassment – damages requestedHostile work environmentCo-worker grievanceDissolution of a partnership
Python #Use an input statement to ask the user for his/her age (no prompt) and assign...
Python #Use an input statement to ask the user for his/her age (no prompt) and assign the user entry to a variable #Convert the user input to an integer and assign to a variable #Write if-elif-else statements with the following conditions and actions #Important: For each Action below, use the same variable name for the rating in all the if, elif, and else statements #Condition: user input less than or equal to 9 Action: assign the letter G as a...
Why is the use of NaHCO3 in this experiment an example of Green Chemistry? You must...
Why is the use of NaHCO3 in this experiment an example of Green Chemistry? You must reference at least two principles of green chemistry in your response.
Use C language , pointer limit use //#include <stdio.h> //#include <stdlib.h> //#include <time.h> For example, I...
Use C language , pointer limit use //#include <stdio.h> //#include <stdlib.h> //#include <time.h> For example, I have random array [4,2,7,1,9,8,0]. Sort the array's index but cannot change the position of item in the array, if you copy the array to a new array, you also cannot change the item's position in array. The index now is[0,1,2,3,4,5,6] The output should be[6,3,1,0,2,5,4]
This function will be given a list of strings and a character. You must remove all...
This function will be given a list of strings and a character. You must remove all occurrences of the character from each string in the list. The function should return the list of strings with the character removed. Signature: public static ArrayList<String> removeChar(String pattern, ArrayList<String> list)
Part 1:Describe an example of a minimally diverse portfolio. You must include at least 3 investments...
Part 1:Describe an example of a minimally diverse portfolio. You must include at least 3 investments and the percentage of distribution for each Part 2: Explain why this portfolio is minimally diverse Part 3: Explain whether this portfolio is aggressive, conservative, or moderate portfolio and why
*****MUST ONLY USE****** #include <iostream> #include <fstream> #include <string.h> #include <stdio.h> Description The word bank system...
*****MUST ONLY USE****** #include <iostream> #include <fstream> #include <string.h> #include <stdio.h> Description The word bank system maintains all words in a text file named words.txt. Each line in the text file stores a word while all words are kept in an ascending order. You may assume that the word length is less than 20. The system should support the following three functions: Word lookup: to check whether a given word exists in the word bank. Word insertion: to insert a...
Do not use global variables. Note : The interleave function should not accept input or display...
Do not use global variables. Note : The interleave function should not accept input or display any output. The function should work with any size strings. Caution : Inclusion of unnecessary or unrelated logic or code segment will result in loss of points. Write C a program that has a main function and a utility function called merge. The main function should prompt the user to enter one short string (no longer than 20 characters) and hard code another string...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT