嗨,我对以下C ++程序感到困惑。寻求帮助
员工每周工资为17.25美元,一周工作40小时。如果员工工作超过40小时,则视为加班。超过40小时但小于或等于60的任何小时均按加班费(每小时12.34美元)支付。超过60小时但小于等于80小时的任何小时均按加班费(每小时14.34美元)支付。超过80小时的任何小时都以加班费(每小时16美元)支付。
从工人的工资总额中扣除14%的联邦所得税,5%扣缴州所得税。扣留80美元用于支付工人和2名家属的保险。如果工人有2个以上的家属,则每个受抚养人保留额外的25美元。编写一个程序,该程序将以员工的名义(使用getline),一周工作小时数和受抚养人数作为输入读取。然后,该计划应输出工人的姓名,家属人数,工资总额,每个预扣金额以及本周的净实得工资。
注意显示的金额应该是固定点,显示点和小数点后正好2位有效数字。
请注意,用户提供的ONLY INPUTS是
- 员工的名字。
- 本周的工作小时数。
- 受抚养人数量。
以下是四个样本I / O
净支票计算器
员工姓名:John Smith
一周工作小时数:43
员工家属人数:3
-------------------------------- -------------------------------------
员工姓名:John Smith
家属人数:3
工作小时数:43
加班时间:3
总收入:$ 727.02
国家税收扣缴@ 5%:36.35美元
联邦税扣缴@ 14%:$ 101.78
工人和2户家属保险:$ 80.00
额外家属保险:$ 25.00
------------------------------- --------------------------------------
Net Take Home Pay:$ 483.89
净支票计算器
员工姓名:John Smith
一周工作小时数:63
员工家属人数:0
--------------------------- ------------------------------------------
员工姓名:John Smith
家属人数:0
工作小时数:63
加班时间:23
总收入:979.82美元
扣缴州税5%:48.99美元
联邦税扣除@ 14%:137.17美元
工人和2户家属保险:$ 80.00
额外家属保险:$ 0.00
-------------------------- ------------ -------------------------------
Net Take Home Pay:$ 713.65
净支票计算器
员工姓名:John Smith
一周工作小时数:35
员工家属人数:2人/>
------------------------------------ ---------------------------------
员工姓名:John Smith
家属人数:2
工作小时数:35
加班时间:0
总收入:$ 603.75
扣缴国家税5%:30.19美元
联邦税扣除@ 14%:$ 84.53
工人和2户家庭保险:$ 80.00
额外家属保险:0.00美元>
--------------------------------------------- ------------------------
Net Take Home Pay:$ 409.04
净支票计算器
员工姓名: John Smith
一周工作小时数:82
员工家属人数:4
- -------------------------------------------------- ------------------
员工姓名:John Smith
家属人数:4
营业时间:82
加班时间:42
总收入:$ 1255.60
国家税收@ 5%:$ 62.78
联邦预扣税款@ 14%:$ 175.78
工人及2户家属保险:$ 80.00
额外供养s'保险:$ 50.00
------------------------------------- --------------------------------
Net Take Home Pay:$ 887.04
我尝试了什么:
i已完成此部分但无法进行了解问题的下一部分...编写一个程序,该程序将以员工的名义(使用getline),一周工作小时数和受抚养人数作为输入。
An employee is paid at a rate of $17.25 per hour for up to 40 regular hours worked in a week. If the employee works more than 40 hours, it is considered overtime. Any hours over 40 hours but less than or equal to 60 are paid at the overtime rate ($12.34 per hour). Any hours over 60 hours but less than equal to 80 hours are paid at the overtime rate ($14.34 per hour). Any hours over 80 hours are paid at the overtime rate ($16.00 per hour).
From the worker’s gross pay, 14% is withheld for federal income tax, 5% is withheld for state income tax. $80 is withheld to cover the insurance of the worker and 2 dependents. If the worker has more than 2 dependents, then an additional $25 is withheld per dependent for insurance. Write a program that will read in the name of the employee (use getline), number of hours worked in a week and the number of dependents as input. The program should then output the worker’s name, number of dependents, gross pay, each withholding amount, and the net take-home pay for the week.
Note the money amount displayed should be in fixed point, show point and exactly 2 significant digits after the decimal point.
Note that the ONLY INPUTS the user provides are
- The employee’s name.
- The number of hours worked in the week.
- The number of dependents.
Below are four Sample I/O
Net Paycheck Calculator
Employee's Name: John Smith
Number of Hours Worked in a Week: 43
Number of Employee's Dependents: 3
---------------------------------------------------------------------
Employee's name :John Smith
Number of Dependents :3
Hours worked :43
Overtime hours :3
Gross Income :$727.02
State Tax Withheld @ 5% :$36.35
Federal Tax Withheld @ 14% :$101.78
Worker and 2 Dependents' Insurance :$80.00
Additional Dependents' Insurance :$25.00
---------------------------------------------------------------------
Net Take Home Pay :$483.89
Net Paycheck Calculator
Employee's Name: John Smith
Number of Hours Worked in a Week: 63
Number of Employee's Dependents: 0
---------------------------------------------------------------------
Employee's name :John Smith
Number of Dependents :0
Hours worked :63
Overtime hours :23
Gross Income :$979.82
State Tax Withheld @ 5% :$48.99
Federal Tax Withheld @ 14% :$137.17
Worker and 2 Dependents' Insurance :$80.00
Additional Dependents' Insurance :$0.00
---------------------------------------------------------------------
Net Take Home Pay :$713.65
Net Paycheck Calculator
Employee's Name: John Smith
Number of Hours Worked in a Week: 35
Number of Employee's Dependents: 2
---------------------------------------------------------------------
Employee's name :John Smith
Number of Dependents :2
Hours worked :35
Overtime hours :0
Gross Income :$603.75
State Tax Withheld @ 5% :$30.19
Federal Tax Withheld @ 14% :$84.53
Worker and 2 Dependents' Insurance :$80.00
Additional Dependents' Insurance :$0.00
---------------------------------------------------------------------
Net Take Home Pay :$409.04
Net Paycheck Calculator
Employee's Name: John Smith
Number of Hours Worked in a Week: 82
Number of Employee's Dependents: 4
---------------------------------------------------------------------
Employee's name :John Smith
Number of Dependents :4
Hours worked :82
Overtime hours :42
Gross Income :$1255.60
State Tax Withheld @ 5% :$62.78
Federal Tax Withheld @ 14% :$175.78
Worker and 2 Dependents' Insurance :$80.00
Additional Dependents' Insurance :$50.00
---------------------------------------------------------------------
Net Take Home Pay :$887.04
What I have tried:
i have done this part but could'nt able to understand the next part of the question...Write a program that will read in the name of the employee (use getline), number of hours worked in a week and the number of dependents as input.
每小时17.25,一周工作40小时。如果员工工作超过40小时,则视为加班。超过40小时但小于或等于60的任何小时都按加班费率支付(
17.25 per hour for up to 40 regular hours worked in a week. If the employee works more than 40 hours, it is considered overtime. Any hours over 40 hours but less than or equal to 60 are paid at the overtime rate (
每小时12.34)。超过60小时但小于等于80小时的任何小时都按加班费率支付(
12.34 per hour). Any hours over 60 hours but less than equal to 80 hours are paid at the overtime rate (
每小时14.34)。超过80小时的任何小时都以加班费率支付(
14.34 per hour). Any hours over 80 hours are paid at the overtime rate (