The following is an assignment for my C++ class.. (1) Payroll (from a Savitch Ch
ID: 3664922 • Letter: T
Question
The following is an assignment for my C++ class..
(1) Payroll (from a Savitch Chapter 2 programming project) An employee is paid at the rate of $16.78 per hour for the first 40 hours worked in a week. Any hours over that are paid at the overtime rate of one-and-one-half times that. From the worker’s total pay, 6% is withheld for Social Security tax, 14% is withheld for federal 3 income tax, 5% is withheld for state income tax, and $10 per week is withheld for union dues. If the worker has three or more dependents, then an additional $35 is withheld to cover the extra cost of health insurance beyond what the employer pays. Your task is to write a program that will read in the number of hours worked in a week and the number of dependents as input, and will then output the worker’s total pay, each withholding amount, and the net take-home pay for the week. Solve this problem in four steps:
(i) Problem solving discussion: Both you and your partner should work on it first individually (using a pencil and paper — don’t start typing yet) for three minutes. This will not be enough time to solve the problem, but will be enough for you to check if you understand the problem, and to get started on solving it. After three minutes, compare the problem solving approach you are using with your partner’s approach. Are they similar or different?
(ii) Outline: You and your partner should collaboratively come up with a detailed outline of the problem. Don’t use C++ yet. Instead use an English-like description (pseudocode) to outline all the steps the program will need to do, in the order it will need to do them.
(iii) Code: Once you have the outline written, (collaboratively) turn it into a C++ program.
(iv) Test and revise: Make up test cases, test your program, correct it as needed, and continue testing and revising until your program is correct.
Check and Discussion: Before going on to the challenge question you and your partner should individually write down (i) one important thing you learned in the lab so far, and (ii) one question you still have about the C++ you used in the lab today. When you have both written down answers, share them with each other.
Explanation / Answer
(I). Per one hour he will get $16.78 upto first 40 hrs of a week.
For each extra hour he will get 1and one half per an hour so 1+1/2 = 3/2
The payment for the employee for the extra hour = $16.78*3/2
=$25.17
So We can find the over time amount =$25.17 * No .of hours.(Take it as a constant).
For finding extra hours: hrs-40
For union dues $10 will be with held so, we should deduce $10 from the employee total pay.
Here one question arises that if the employee pays extra for the insurence,we should duduct $35 if he has more than 3 dependents. for that we should take insurence paid is also an input.
Here i am considering the case that health insurense is seperately paid by the emp.
Else
$35 should be cut from what he pays as total tax if he hasmore than 3 dependents.
for that NTpay=totalpay-sst-fdit-stit-ins-35
(ii) Pseudocode:
Input:
Define sst,fdit,stit,ud
Hr,dep,ins
Output:
TotPay,Ntpay.
Enter Hrs (suppose 50)
if hrs=40 then
total pay= 40*16.78
else hrs>40
{
total pay=40*$16.78+const*(hrs-40)
}
sst=totalpay*6/100;
fIt=totalpay*14*100;
stit=total pay*5/100;
if dep<3
No extra insurence for health.
NTpay=totalpay-sst-fdit-stit-ins-ud
if dep>=3
NTpay=totalpay-sst-fdit-stit-ins-$35-ud.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.