Write a program that can be used to simulate a simple income tax program. Your p
ID: 3626782 • Letter: W
Question
Write a program that can be used to simulate a simple income tax program. Your program must determine the taxable income, tax credits, tax owed, tax payable and determine whether a refund is due or a balance owed for an individual. To calculate the taxable income, subtract the union dues and employment insurance contributions. The tax owed is calculated as follows:If the taxable income is:
<!--[if !supportLists]-->· <!--[endif]-->Between $0 and$37,178, the tax owed is 15% of the taxable income.
<!--[if !supportLists]-->· <!--[endif]-->Between $37,178 and$74,357, the tax owed is $5,577 plus 22% of the taxable
income over $37,178.
<!--[if !supportLists]-->· <!--[endif]-->Between $74,357 and$120,887, the tax owed is $13,756 plus 26% of the taxable income over $74,357.
<!--[if !supportLists]-->· <!--[endif]-->Over $120,887, the tax owed is $25,854 plus 29% of the taxable income over $120,887.
The tax credits are calculated by taking 15% of the sum of the following:
<!--[if !supportLists]-->· <!--[endif]-->Basic personal amount of $9,600.
<!--[if !supportLists]-->· <!--[endif]-->Employment amount of$1000.
<!--[if !supportLists]-->· <!--[endif]-->Spouse amount -calculated as: $9,656 - spouse's gross income. If the result is negative, set the value to 0. This amount can have a maximum value of $8,778.
<!--[if !supportLists]-->· <!--[endif]-->Child exemption of$2743 for each child under 18.
<!--[if !supportLists]-->· <!--[endif]-->Pension plan - person can also put up to 6% of his or her gross income tax-free into a pension plan.
Prompt the user to enter the following information:
<!--[if !supportLists]-->· <!--[endif]-->Marital status
<!--[if !supportLists]-->· <!--[endif]-->If the marital status is "married" ask for the number of children under the age of 18
<!--[if !supportLists]-->· <!--[endif]-->Gross salary (If the marital status is "married" and both spouses have income, get the salary for each.)
<!--[if !supportLists]-->· <!--[endif]-->Union dues
<!--[if !supportLists]-->· <!--[endif]-->Employment insurance
<!--[if !supportLists]-->· <!--[endif]-->Percentage of gross income contributed to a pension fund
<!--[if !supportLists]-->· <!--[endif]-->Tax paid
Your program must consist of at least the following functions:
i. <!--[endif]-->getData: This function gets the relevant data from the user.
ii. <!--[endif]-->getTaxableIncome: This function computes and returns the taxable income.
iii. <!--[endif]-->getTaxOwed: This function computes and returns the tax owed.
iv. <!--[endif]-->getTaxCredits: This function computes and returns the tax credits.
v. <!--[endif]-->getTaxPayable: This function computes and returns the tax payable.
vi. <!--[endif]-->getBalance: This function determines whether there is a refund or a balance owing.
vii. <!--[endif]-->printReport: This function writes the summary report to a file.
The tax payable is calculated as: tax owed - tax credits. If this difference is negative, set the tax payable to 0. The balance owing or refund is calculated as: tax payable - tax paid. If this difference is negative, a refund is due, if positive a balance is owed. Your program should also produce a summary report which details the gross salary, taxable income, tax credits, tax owed, tax payable,tax paid and refund or balance owing.
(please fix my code and add the missing stuff)
#include<iostream>
#include<string>
using namespace std;
void getData(char&, double&, double&, double&, double&, double&, double&);
double getTaxableIncome(double&,double,double);
double getTaxOwed(double&,double);
double getTaxCredits(double&, double);
double getTaxPayable(double& , double, double);
void printReport(double,double,double,double,double);
int main()
{
char marital;
double NumOfChild=0;
double GrossSalary=0;
double unionDues=0;
double EI=0;
double percentage=0;
double TaxPaid=0;
double taxbleIncome=0;
double Taxowed=0;
double TaxCredits=0;
double TaxPayable=0;
getData(marital, NumOfChild, GrossSalary, unionDues, EI, percentage,TaxPaid );
getTaxableIncome(taxbleIncome,unionDues,EI);
getTaxOwed(Taxowed,taxbleIncome);
getTaxCredits(TaxCredits, NumOfChild);
getTaxPayable(TaxPayable,Taxowed, TaxCredits);
printReport(GrossSalary,taxbleIncome,TaxCredits,Taxowed,TaxPayable);
return 0;
}
void getData(char& marital,double& NumOfChild,double& GrossSalary,double& EI,double& unionDues,double& percentage,double& TaxPaid )
{
cout << "Enter the Narital status: " << endl;
cin >> marital;
if(marital== 'm')
{
cout << "Enter number of children: " << endl;
cin >> NumOfChild;
}
else
NumOfChild=0;
cout << "Enter the gross salary: "<< endl;
cin>>GrossSalary;
cout << "enter employeement insurance: " << endl;
cin >> EI;
cout << "enter union dues: " << endl;
cin >> unionDues;
cout << "enter the presantage: " << endl;
cin>> percentage;
cout << "Enter the tax paid: " << endl;
cin >> TaxPaid;
}
double getTaxableIncome( double& taxbleIncome, double unionDues,double EI)
{
return (taxbleIncome=(EI - unionDues ));
}
double getTaxOwed(double& Taxowed,double taxbleIncome)
{
if(taxbleIncome >= 0 && taxbleIncome <= 37178)
return(Taxowed=(taxbleIncome*0.15));
else if(taxbleIncome > 37178 && taxbleIncome <= 74357)
return(Taxowed=(5577+(.22*taxbleIncome)/37178));
else if (taxbleIncome > 74357 && taxbleIncome <= 120887)
return(Taxowed=(13756+(.26*taxbleIncome)/74357));
else
return(Taxowed=(25854+(.29*taxbleIncome)/120887));
}
double getTaxCredits(double& TaxCredits,double NumOfChild )
{
return(TaxCredits=(((9656+1000)*0.15)+(2743*NumOfChild)));
}
double getTaxPayable(double& TaxPayable,double Taxowed,double TaxCredits)
{
TaxPayable=(Taxowed-TaxCredits);
if (TaxPayable < 0)
return (TaxPayable=0);
else
return TaxPayable;
}
void printReport(double GrossSalary,double taxbleIncome,double TaxCredits,double Taxowed,double TaxPayable)
{
cout <<"The Gross Salary is:"<< GrossSalary << endl;
cout << "The taxable income is: "<< taxbleIncome << endl;
cout << "The tax credits is: " << TaxCredits << endl;
cout << "The tax owed is : " << Taxowed<< endl;
cout << "The tax pay able is : " << TaxPayable << endl;
return;
}
Explanation / Answer
please rate - thanks
hope this helps
#include<iostream>
#include<string>
using namespace std;
void getData(char&, double&, double&, double&, double&, double&, double&, double&);
double getTaxableIncome(double,double,double);
double getTaxOwed(double);
double getTaxCredits( double,double,double,double);
double getTaxPayable(double, double);
void printReport(char,double,double,double,double,double,double);
int main()
{
char marital='n';
double NumOfChild=0;
double GrossSalary=0;
double GrossSalary2=0;
double unionDues=0;
double EI=0;
double percentage=0;
double TaxPaid=0;
double taxbleIncome=0;
double Taxowed=0;
double TaxCredits=0;
double TaxPayable=0;
getData(marital, NumOfChild, GrossSalary,GrossSalary2, unionDues, EI, percentage,TaxPaid );
taxbleIncome=getTaxableIncome(GrossSalary+GrossSalary2,unionDues,EI);
Taxowed=getTaxOwed(taxbleIncome);
TaxCredits=getTaxCredits(GrossSalary,GrossSalary2,GrossSalary*percentage/100., NumOfChild);
TaxPayable=getTaxPayable(Taxowed, TaxCredits);
printReport(marital,GrossSalary,GrossSalary2,taxbleIncome,TaxCredits,Taxowed,TaxPayable);
system("pause");
return 0;
}
void getData(char& marital,double& NumOfChild,double& GrossSalary,double& GrossSalary2,double& EI,double& unionDues,double& percentage,double& TaxPaid )
{
cout << "Enter the Marital status: " << endl;
cin >> marital;
if(marital== 'm')
{
cout << "Enter number of children: " << endl;
cin >> NumOfChild;
cout << "Enter your gross salary: "<< endl;
cin>>GrossSalary;
cout << "Enter your spouses gross salary: "<< endl;
cin>>GrossSalary2;
}
else
{
NumOfChild=0;
cout << "Enter the gross salary: "<< endl;
cin>>GrossSalary;
}
cout << "enter employeement insurance: " << endl;
cin >> EI;
cout << "enter union dues: " << endl;
cin >> unionDues;
cout << "Percentage of gross income contributed to a pension fund: " << endl;
cin>> percentage;
cout << "Enter the tax paid: " << endl;
cin >> TaxPaid;
}
double getTaxableIncome(double salary, double unionDues,double EI)
{
return (salary-(EI + unionDues ));
}
double getTaxOwed(double taxbleIncome)
{
if(taxbleIncome >= 0 && taxbleIncome <= 37178)
return((taxbleIncome*0.15));
else if(taxbleIncome > 37178 && taxbleIncome <= 74357)
return((5577+(.22*taxbleIncome)/37178));
else if (taxbleIncome > 74357 && taxbleIncome <= 120887)
return((13756+(.26*taxbleIncome)/74357));
else
return((25854+(.29*taxbleIncome)/120887));
}
double getTaxCredits(double salary,double spouse,double pension,double NumOfChild )
{double credit=0;
credit=9600+1000+2743*NumOfChild;
spouse=9656-spouse;
if(spouse<0)
spouse=0;
if(spouse>8778)
spouse=8778;
return credit+spouse+pension;
}
double getTaxPayable(double Taxowed,double TaxCredits)
{double TaxPayable;
TaxPayable=(Taxowed-TaxCredits);
if (TaxPayable < 0)
return (0);
else
return TaxPayable;
}
void printReport(char m,double GrossSalary,double GrossSalary2,double taxbleIncome,double TaxCredits,double Taxowed,double TaxPayable)
{cout <<"Your Gross Salary is:"<< GrossSalary << endl;
if(m=='m')
cout <<"Your Spouses Gross Salary is:"<< GrossSalary2 << endl;
cout << "The taxable income is: "<< taxbleIncome << endl;
cout << "The tax credits is: " << TaxCredits << endl;
cout << "The tax owed is : " << Taxowed<< endl;
cout << "The tax pay able is : " << TaxPayable << endl;
return;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.