rite a C++ program to calculate a person’s pay stub assuming paid on a monthly basis.
Write a C++ program to calculate a person’s pay stub assuming paid on a monthly basis.
INPUT
Input the employee’s 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 (
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 $132,900, multiply current
earnings by 6.2%; if year-to-date earnings greater than or equal to 132,900 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 80.60 from current earnings and compute tax according to
chart below: (The chart is in the images 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
CHECKPOINTS
2) 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.
3) Use exactly one function separate from main for input.
4) 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.
5) 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.
6) Pass by reference variable is used when needed and only when needed.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images