The function prototype of a function that computers an employee\'s gross pay and
ID: 3808005 • Letter: T
Question
The function prototype of a function that computers an employee's gross pay and net pay given his pay rate and number of hours of work is given as follows: void compute Gross Net (double pay Rate, int hrs, double & gross, double & net); Write the sequence of statements to compute (by calling this function) and print the gross pay and the net pay of an employee with pay rate $12.50 and number of hours of work 35. The function prototype of a function that computes an employee's tax deduction given his gross pay is given as follows: double compute Tax (double gross); Write the sequence of statements to read an employee's gross pay and to compute (by calling this function) and print his tax deduction.Explanation / Answer
3)
computeGrossNet(12.5,36,*gross,*net);
void computeGrossNet(double payRate,double int hrs,double &gross,double &net)
{
double hours=(double)hrs;
double tax=((payRate*hours)/100)*X;//X is the tax rate
*gross=payRate*hours;
*net=gross-tax;
cout<<"gross is "<<*gross<<" net is "<<*net;
}
4)
tax=computeTax(gross);
double computeTax(double gross)
{
double taxrate=20;
double tax;
tax=(gross/100)*taxrate;
cout<<"tax is "<<tax;
return tax;
}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.