Question
Write a C++ program to calculate a persons pay stub assuming paid on a monthly basis. Your design must be according to the structure chart
Write a C++ program to calculate a persons pay stub assuming paid on a monthly basis.
Your design must be according to the structure chart given here. That is main() will call input function, calculation function, and output function in that order.
INPUT
Input the employees name, hourly wage, hours worked, withholding allowances, marital status as M or S, and previous year-to-date earnings. All input is to be carried out in the input function.
CALCULATIONS
There is one main calculation function which calls another function that will compute the FICA tax and the federal income tax.
Current earnings are computed as hourly wage times hours worked (extra credit if your program pays time-and-a-half after 40 hours).
Year-to-date earnings need to be updated by adding in current earnings.
To compute FICA, if year-to-date earnings are less than $128,700, multiply current earnings by 6.2%; if year-to-date earnings greater than or equal to 128,700 there is no FICA tax i.e. 0.00 .
To compute federal income tax to be withheld, first subtract the product of the withholding allowances times 345.80 from current earnings and compute tax according to chart below:
| |||
|
Amount of check = current earnings FICA tax income tax withheld
OUTPUT
Name of employee, current earnings, year-to-date earnings, FICA tax, income tax withheld, and amount of check. Descriptions are left justified and values are output with two digits to the right of the decimal point and decimal points are lined up.
THEME ISSUES
Functions, sub-functions, pass by reference
Absolutely no global variables permitted
TEST DATA |
|
|
|
|
|
Name Hourly | Hours |
| Withholding | Marital | Year-to-date |
Wage | Worked |
| Allowances | Status | Earnings |
Al Clark 48.50 | 38 |
| 2 | M | 88,600.00 |
Karen Chen 44.00 | 35 |
| 3 | M | 68,200.00 |
Nathan Chan 25.50
| 50 |
| 1 | S | 36,295.50 |
|
|
|
|
|
|
SAMPLE OUTPUT
Al Clark |
|
|
Current Earnings |
| 1843.00 |
Year-to-date |
| 90443.00 |
FICA tax |
| 114.27 |
Income Tax Withheld 18.84
Amount of check 1709.89
CHECKPOINTS
Include name, e-mail, and lab# as comments in the code and also include code to output this information to the output.
Minimum of three (3) comments (including Pre/Post) in each function of the exactly 4 functions other than main() (see structure chart). A fifth signature function is optional, but no more. Pre comments must identify reference variables, i.e. reference to hourly wages. All functions (other than main() & your signature function) must use prototype style.
Use exactly one function separate from main for input.
Call a calculation function from main which handles all calculations. This function needs to call a sub-function (another function) to calculate exactly the following and no more: amount of FICA tax and amount of federal income tax withheld.
Use exactly one function separate from main for output. Output must be formatted exactly as shown on lab write-up with decimal points lined up.
Pass by reference variable is used when needed and only when needed.
main0 Input all data Handles all calculations Output Computes federal tax and FICA tax
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started