Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I am so confused on how to pass variables while addressing variables which store

ID: 3533275 • Letter: I

Question

I am so confused on how to pass variables while addressing variables which store other information. If you have the book, I am working on problem 18 on page 410, chapter 10. I do not necessarily need answers, just help figuring out how to write out this particular function. I do believe I have everything else correct.


main function

....

Algorithm

....

2. repeat while (salary >0)

           call the calcFedTaxes function to calculate the FWT and FICA, pass the function the salary, FWT rate, FICA rate, and addresses of variables in which to store the FWT and FICA

           call the calcNetPay function to calculate the net pay, pass the function the salary, FWT, FICA, and addresses of the variable in which to store the net pay

....

....

....

Explanation / Answer

#include #include #include #include using namespace std; //function prototypes void calcFedTaxes (double salary, double &fwt, double &fica); void calcNetPay (double salary, double &fwt, double &fica); void displayInfo (double &fwt, double &fica, double &netPay); int main() { //Declare variables double salary = 0.0; double fwt = 0.0; double fica = 0.0; double netPay = 0.0; do { //get input items cout > salary; //call functions calcFedTaxes (salary, fwt, fica); calcNetPay (salary,fwt,fica); displayInfo (fwt,fica,netPay); } while (salary > 0); system ("pause"); return 0; } //end of main function //function definitions void calcFedTaxes (double salary, double &fwt, double &fica) { double fwtRate = 0.2; fwt = (salary * fwtRate); double ficaRate = 0.08; fica = (salary * ficaRate); } // end calFedTaxes function void calcNetPay (double salary, double &fwt, double &fica) { double netPay = 0.0; netPay = (salary - fwt - fica); } // end calcNetPay function void displayInfo (double &fwt, double &fica, double &netPay) { cout
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote