Tags:
create new tag
view all tags

Lab 1-1

Due Feb 1, 11:59pm

Moodle Link

payroll-calculation1.jpg

An employee is paid at a rate of $16.68 per hour for the first 40 hours worked in a week. Any hours over that are paid at the overtime rate of one and one half times that. From the worker’s gross pay, 6% is withheld for social security tax, 14% is withheld for federal income tax, 5% is withheld for state income tax, and $10 per week is withheld for union dues. If the worker has three or more dependents, then an additional $35 is withheld to cover the extra cost of health insurance beyond what the employer pays.

Write a program that will prompt the user for the following information:

  1. the number of hours worked in a week
  2. the number of dependents
The program will then output the worker’s gross pay, each deduction amount, and the net take-home pay for the week. Write your program so that it allows the calculation to be repeated as often as the user wishes.

Turn in

  • Turn in the code (a cpp file or ideone.com link), and the run outputs as requested below.
  • Remember to format the code as described and the book and text, and to include comments including complete comment at the beginning of the program.

Coding Requirements:

  1. Starting with this lab, you must follow the guidelines on Program Style described here ( See guidelines here).You will lose points if you don't. You must follow these guidelines in all future labs.
  2. For this lab all decimal point numbers must be printed with 2 digits after the decimal point. (e.g. 2.50 instead of 2.5). See pages 55-57 of the textbook for this.

Trial Data

Run the program for the following data, turning in a document will all run data (as a Word, text or pdf document)

Trial Hours Dependents
1 15 1
2 40 4
3 53 3
4 2 5

Example Run

This program will ask you how many hours you worked, and calculate your
taxes, dues, gross pay, and net pay.

How many hours did you work? 20
How many dependents do you have? 1

Regular hours: 20.00 (at $16.68 an hour)
Overtime hours: 0.00 (at $25.02 an hour)
Total hours: 20.00

Gross pay is $333.60

Social Security tax: $20.02
Federal taxes: $46.70
State taxes: $16.68
Union Dues: $10.00
Total Deductions: $93.40

Net Pay: $240.20.

Would you like to calculate another week's pay? (y or n) y

How many hours did you work? 48
How many dependents do you have? 4

Regular hours: 40.00 (at $16.68 an hour)
Overtime hours: 8.00 (at $25.02 an hour)
Total hours: 48.00

Gross pay is $867.36

Social Security tax: $52.04
Federal taxes: $121.43
State taxes: $43.37
Union Dues: $10.00
Family Health Insurance: $35.00 (additional insurance premiums for your family)
Total Deductions: $261.84

Net Pay: $605.52.

Would you like to calculate another week's pay? (y or n) y

How many hours did you work? 3
How many dependents do you have? 4

Regular hours: 3.00 (at $16.68 an hour)
Overtime hours: 0.00 (at $25.02 an hour)
Total hours: 3.00

Gross pay is $50.04

Social Security tax: $3.00
Federal taxes: $7.01
State taxes: $2.50
Union Dues: $10.00
Family Health Insurance: $35.00 (additional insurance premiums for your family)
Total Deductions: $57.51

Your dues and insurance obligations outstripped your pay by $-7.47.

Would you like to calculate another week's pay? (y or n) n


Thank you for using this program.

 

Grading Table

Requirement Grading Comments Points Score
Correct output on required trial data   60  
Dollar amount with 2 places after decmail point.   10  
Appropriate code formatting   5  
Meaningful identifier names (variables)   5  
Description Comments on top   5  
Section comments throughout   5  
Document wth trial runs included   10  
Total   100  
Solution
  • payroll-calculation1.jpg:
Topic attachments
I Attachment History Action Size Date Who Comment
JPEGjpg payroll-calculation1.jpg r1 manage 52.5 K 2017-01-17 - 02:56 JimSkon  
Edit | Attach | Watch | Print version | History: r19 < r18 < r17 < r16 < r15 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r19 - 2018-01-16 - JimSkon
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2018 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback