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 nowThis is a popular solution!
Step by stepSolved in 2 steps with 1 images
- Local variables are known only to the function in which they are declared. Local variables are invisible outside the function in which they are declared. Whether True or False 11. It is possible for any function to return numerous values. Any function type may return multiple values. That's true, right?arrow_forwardWrite a c++ program that contains a “main” and 4 functions: In the main function declare 4 integer variables x, y, z and m and call the following functions: The first function is to initialize the 4 variables using the last 4 digits of your university ID number. For example, if your ID number is 43956789 then you x=6, y=7, z=8, and m =9. The second function should calculate and print the average of the 4 variables. The third function is to find the largest number of the 3 variables. The last function should double the values of the 4 variables. For example if x = 6 then x will become 12.arrow_forwardCould you help me create a python code for this question? Thanks.arrow_forward
- PYTHON Question 3: Rain or Shine Part 1: Alfonso will only wear a jacket outside if it is below 60 degrees or it is raining. Write a function that takes in the current temperature and a boolean value telling if it is raining and it should return True if Alfonso will wear a jacket and False otherwise. Try solving this problem with a single line of code. def wears_jacket(temp, raining): """ >>> wears_jacket(90, False) False >>> wears_jacket(40, False) True >>> wears_jacket(100, True) True """ *** YOUR CODE HERE *** Note that it should either return True or False based on a single condition, whose truthiness value will also be either True or False. Part 2: Rewrite the above function with a lambda expression.arrow_forwardDo not use global variables for this assignment Choose descriptive variable names in all programs. Currency format. There should be no space between the $ sign and the first digit. In python, Write a program that uses a custom function named as you wish and the main function. In main, prompt the user for a first name and an integer less than 10 and then execute the custom function with these two inputs as arguments. The custom function should output one line displaying the name as many times as specified by the integer, separating each repetition of the name with a space.arrow_forward*DONOT USE CHATGPT, please put comments so i can understand. It’s a C language program with algorithm.arrow_forward
- C++ with multiple functions if possible Write a program to simulate an automated teller machine (ATM) at a bank. The program should ask the user for a four-digit personal identification number (PIN) to verify they are supposed to have access to the account. If they enter the PIN incorrectly, they should be denied access to the account, but the program should automatically ask them to enter the PIN again. It is up to you to decide if you want to give a maximum number of tries before exiting. The ATM program should ask the user for a beginning balance, and then provide the user with the opportunity to enter deposits and withdrawals until the user wishes to exit the program. Upon exiting the program, it needs to display the current balance.arrow_forwardSolve it as soon as possible using C programarrow_forwardI am creating a c++ snakes and ladders game (no visuals). I want the game to have up to 5 or 6 players. For the snakes/ladders I am going to create a function which needs the dice roll and adds it to the score which will then decide if the player has landed on a snake or a ladder, is there any way I can get all players scores to be stored in the “score” variable in the switch statements without using multiple switch statements? So I basically want a switch statement which can accommodate all 1-6 players . E.g p1 initially at 1 rolls a 4. So their new score is 1+4=5, then the switch function checks for a ladder or snake. Then player 2 who's initially a 2 rolls a 5, so their new score is 2+5=7 then THE SAME switch function checks for a snake or ladder... And so on for all other players.arrow_forward
- // // Write a function that calculates the amount of money a person would earn over // a period of years if his or her salary is one penny the first day, two pennies // the second day, and continues to double each day. The program should ask the // user for the number of years and call the function which will return the total // money earned in dollars and cents, not pennies. Assume there are 365 days // in a year. // function totalEarned (years) { // Insert your code between here and the next comment block. Do not alter // // any code in any other part of this file. // Insert your code between here and the previous comment block. // any code in any other part of this file. Do not alter // // var years = parseInt(prompt('How many years will you work for pennies a day? ')); var totalDollarsEarned = totalEarned (years); alert('Over a total of ' + years + ', you will have earned $' + totalDollarsEarned);arrow_forwardLocal variables are known only to the function in which they are declared. Local variables are invisible outside the function in which they are declared. Whether True or False 11. It is possible for any function to return numerous values. Any function type may return multiple values. That's true, right?arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education