Question
C++: Prompt the user for the employee name, number of hours worked and the rate of pay. Anything over 40 hours is considered overtime. Overtime
C++: Prompt the user for the employee name, number of hours worked and the rate of pay. Anything over 40 hours is considered overtime. Overtime is paid as time and half.
List the regular pay separate from overtime pay, then the gross pay is the regular and overtime added together.
Calculate the tax deductions after the insurance and pension plan has been deducted from the gross pay. Insurance is $75.00 per week, retirement plan is 6% of gross pay, and taxes are 23% of gross pay after deductions for insurance and retirement plan.
Output the data to a file as well as the screen. Make sure that all decimal places line up and use setfill so there are no blank spaces between the item listed and the dollar amount.
Your itemized list should include:
Employee Name
Total Hours Worked
Gross Pay for Regular Hours
Gross Pay for Overtime Hours
Total Gross Pay
Insurance Deduction
Retirement Plan Deduction
FICA taxes
Net Pay
You will need to use an if statement to determine if the employee worked over 40 hours and if they are participating in the pension plan and do they have insurance. So, here is how an if statement works in C++:
if(hoursWorked > 40)
{
overtimeHours = hoursWorked - 40;
}
For testing whether they are participating in insurance plan or pension plan, the if statement would look like this:
if(pensionPlan == 'y' || pensionPlan == 'Y')
{
pensionPay = grossPay * 0.06;
}
The 2 pipes (||) in the middle of the if statement represent or in C++.
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