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

Write a \"C\" program to implement the function interface below as an external f

ID: 3629929 • Letter: W

Question

Write a "C" program to implement the function interface below as an external function. test your solution using the stub program shown below.

-------------------------------------------------------------------------------------------------------

void CalculateTaxes(float gross,float deferred,
float *fedtax,
float *statetax,
float *ssitax); //3.5
float CalcFedtax(float gross, float deferred); //3.5.1
float CalcStateTax(float fedtax); //3.5.2
float CalcSSItax(float gross, float deferred); //3.5.3

// Stub program code
#include <stdio.h>
#define ADDR(var) &var

int main(void)
(
float ft,st,ssit;

CalculateTaxes(1000, 100, ADDR (st), ADDR(ssit);
printf(" FedTax = %8.2f ", ft);
printf(" StateTax = %8.2f , st);
printf(" SSITax = %8.2f , ssit);
fflush(stdin);
// on some Unix/Linux systems, fflush() does not work as in Windows.
// substitute the following: while (getchar() != ' ');
getchar();
return 0;
}

-------------------------------------------------------------------------------------------------------

I have no idea how to implement the function as an external function.

Explanation / Answer

Dear... #include"stdafx.h" #include <iostream> #include <iomanip> #include <iomanip> #include <stdlib.h> #include <stdio.h> #include <fstream> #include <string.h> #include "calcTaxesEX.cpp" using namespace std; #define FEDTAXRATE 0.15 #define STATETAXRATE 0.07 #define SSITAXRATE 0.0775 #define ADDR(var) &var #define Null 0 #define MAX 5 #define REPORTHEADER1 "Employee Pay Reg Hrs Gross Fed SSI Net " #define REPORTHEADER2 "Name Rate Ovt Hrs Pay Pay Defr Pay " #define REPORTHEADER3 "=========== ====== ======== ======= ====== ====== ========= " #define REPORTFORMAT "-28%s,6.2%f,14.2%f,11.2%f,12.2%f,13.2%f,13.2%f,' ',48.2%f,23.2
f,13.2%f" float CalcFedTax(float grossPay,float defr) //3.5.1 { return (grossPay-defr)* FEDTAX;
} void CalculateTaxes(float grossPay,float defr,float *fedtax, float *statetax, float *ssitax) //3.5 {
*fedtax = CalcFedTax(grossPay,defr);
*statetax = CalcStateTax(*fedtax);
*ssitax = CalcSSITax(grossPay,defr);
} float CalcFedTax(float grossPay,float defr) //3.5.1 { { return (defr- grossPay)* FEDTAX;
} float CalcStateTax(float fedtax) // 3.5.2 { return fedtax * STATETAX;
} float CalcSSITax(float grossPay,float defr) { return (defr - grossPay)* SSITAX;
} void AddDetailToAccumulators(float payrate, float over, float regular, float defr, float grossPay, float ft, float st,float ssi, float *net, float *totrate, float *totovrhr, float *totreghr, float *totdefr, float *totgross, float *totft, float *totst, float *totssi, float *totnet) {
*net = grossPay - ft - st - ssi - defr;
*totrate += payrate;
*totovrhr += over;
*totreghr += regular;
*totdefr += defr;
*totgross += grossPay;
*totft += ft;
*totst += st;
*totssi += ssi;
*totnet += *net;
}
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote