1. The best answer is
money ComputeTax( money gross_income, int dependents );
2. The simplest solution is:
money ComputeTax( money gross_income, int dependents )
{
money net_income = gross_income - dependents * 2000.00;
money tax;
if( net_income <= 24000.00 )
tax = net_income * 0.18;
else if( net_income <= 58150.00 )
tax = 24000 * 0.18 + ( net_income - 24000.00 ) * 0.28;
else
{
tax = 24000 * 0.18 + ( 58150.00 - 24000.00 ) * 0.28
+ ( net_income - 58150.00 ) * 0.31;
}
return tax;
}
3. Here is a simple main program.
#include <iostream.h>
#include "money.h"
/* Include the function declaration and definition from parts 1 and 2 here */
int main( )
{
money gross_income, paid_tax, total_tax;
int dependents;
cout << "Enter gross income: " << endl;
cin >> gross_income;
cout << "Enter number of dependents: " << endl;
cin >> dependents;
cout << "Enter taxes already paid: " << endl;
cin >> paid_tax;
total_tax = ComputeTax( gross_income, dependents );
if( total_tax > paid_tax )
cout << "SEND CHECK for " << total_tax - paid_tax << endl;
else
cout << "REFUND for " << paid_tax - total_tax << endl;
return 0;
}