I need c++ code for this algorithm: 1. Enter the salary 2. repeat while( the sal
ID: 3532883 • Letter: I
Question
I need c++ code for this algorithm:
1. Enter the salary
2. repeat while( the salary >0)
call the calcFedTaxes function to calculate the FWT and FICA; pass
the salary, FWT rate, FICA rate, and the addresses of variables in
which to store the FWT and FICA
call the calcNetPay function to calculate the net pay; pass the salary, FWT, FICA, and the
address of the variable in which to store the net pay
call the displayinfo function to display the FWT, FICA, and net pay; pass the FWT, FICA, and net pay
enter the salary
end repeat
Explanation / Answer
/*** complete working code..please rate with 5 stars***/
/** Bolded values of FICArate and FWTrate can be changed manually**/
#include <iostream>
using namespace std;
void calcFedTaxes(double* FWT,double* FICA,double FWTrate,double FICArate,double salary){
*FWT =salary*FWTrate;
*FICA =salary*FICArate;
return;
}
void calcNetPay(double* netPay,double salary,double FICA,double FWT){
*netPay =salary+FICA+FWT;
return;
}
void displayinfo(double netPay,double FICA,double FWT){
cout<<"netPay= "<<netPay<<" FICA= "<<FICA<<" FWT= "<<FWT<<endl;
}
int main() {
double salary,FWT,FICA,FWTrate=0.01,FICArate=0.02,netPay;
cout<<"Enter the salary: ";
cin>>salary;
while(salary>0){
calcFedTaxes(&FWT,&FICA,FWTrate,FICArate,salary);
calcNetPay(&netPay,salary,FICA,FWT);
displayinfo(netPay,FICA,FWT);
cout<<"Enter the salary: ";
cin>>salary;
}
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.