A while ago i had requested help for a Marital and Federal tax program. Unfortunately I'm making this program for a particularly picky person. So I ended up having to remake it somewhat. If someone could take a look and help me with this that'd be cool. Here's what I got:
FederalTaxHeader.h
#ifndef header_h
#define header_h
#include <iomanip>
#include <cmath>
#include <iostream>
#include <string>
#include <cctype>
#include <cstdlib>
#include <fstream>
using namespace std;
namespace Federal_Taxes
{
enum GrossType {LowGross, MedGross, HighGross};
}
using namespace Federal_Taxes;
//List of the different functions
void extern displayRedo ();
char extern MaritalStatus(int Single, int Married);
void extern displayStatus (MaritalType GrossType);
void extern displaygross (int gross);
void extern displayInsuranceCheck ();
char extern getMaritalStatus (char & married);
{);
int extern getGross ();
char extern response ();
void extern askMaritalStatus ();
void extern displayUsage ();
void extern displayPurpose ();
char extern getAnswer ();
void extern myLabel ( const char * assignment, const char * date,
ostream & out);
#endif
calc.cpp
#include "FederalTaxheader.h"
//recieve sides from main, while useing the enum type declared in main
{
GrossType gross; //declares shape under the enum type
if (gross < 0)
void displayRedo ()
{
cout << "\n You have inputted an invalid entry"
"would you like to use this program again? Y/N ";
}
if (gross < 15001)
gross = LowGross;
else if (gross < 40001)
gross = MedGross;
else if (gross > 40000)
gross = HighGross;
}
return GrossType;
}
getData.cpp
#include "FederalTaxheader.h"
using namespace std;
int getNumChildren();
double taxAmount(int,double,double,int);
int main ()
{
void getData();
getData();
return 0;
}
void getData()
{
char status;
char answer;
int noofChildren;
double salary;
double amtInPension;
int numPerson;
int standardExemption;
double tax;
cout << "Enter your Marital Status: M for Married or S for Single ";
cin >> status;
cout << endl;
if (status == 'm' || 'M')
{
noofChildren = getNumChildren();
cout << "Do both spouses earn income? Please enter Y or N. ";
cin >> answer;
cout << endl;
if (answer == 'y' || 'Y')
{
cout << "Please enter combined salary: ";
cin >> salary;
cout << endl;
}
else if (answer == 'n' || 'N')
{
cout << "Please enter salary: ";
cin>> salary;
cout<< endl;
}
numPerson = 2 + noofChildren;
}
else
{
cout << "Please enter salary: ";
cin >> salary;
cout << endl;
numPerson = 1;
}
cout << "Please enter contribution to the Pension Plan: ";
cin >> amtInPension;
cout << endl;
tax = taxAmount(numPerson, salary, amtInPension, standardExemption);
}
int getNumChildren()
{
int children;
cout << "Please enter number of Children under Age 14: ";
cin >> children;
cout << endl;
return children;
}
double taxAmount(int numPerson, double salary, double amtInPension, int standardExemption)
{
double taxableIncome;
taxableIncome = salary - (1500.00 * numPerson) - amtInPension - standardExemption;
return(taxableIncome);
}
input.cpp
#include "FederalTaxheader.h"
char getAnswer () // answer to question so it can continue
{
char answer;
do
{
cin >> answer;
answer = toupper (answer);
cout << " ";
void Flush ();
}
while (answer != 'Y' && answer != 'N');
return (answer);
}
int getMaritalStatus (char & married)
{
char maritalType
int kidnum = 0
do
{
cout << "Enter 'M' for married 'S' for single." << endl;
cin >> MaritalType;
MaritalType = toupper (MaritalType);
while (MaritalType != 'M' || MaritalType != 'S')
married = MaritalType;
if ( married == 'M' )
{
cout << "How many kids under the age of 14 do you have?"
"Enter a whole number only!" << endl;
cin >> kidNum;
}
return (kidNum);
}
int getgross ()
{
int gross;
do
{
askgross ();
cin >> gross;
void Flush ();
} while ( gross <= 0 );
return gross;
}
main.cpp
#include "FederalTaxheader.h"
int main ()
{
char MaritalType;
char response;
char Answer2;
displayPurpose (); //shows what the program does
response ();
{do
{
GrossType gross;
int Low_RATE;
int Med_RATE;
int High_Rate;
do
{
gross = 0; // gross is set to = 0 just in case...
gross = getgross ();
}
while (response == 'Y');
if married
cout << "gross is income of both spouses."
else
cout << "gross is your income."
gross = MaritalStatus (MaritalStatus, gross);
displayStatus (GrossType);
displayRedo ();
Answer2 = getAnswer ();
}
while (Answer2 == 'Y');
}
myLabel ("Federal Taxes 2.0", "02/23/2008", cout);
system("PAUSE");
return EXIT_SUCCESS;
}
output.cpp
#include "FederalTaxheader.h"
void displayPurpose ()
{
cout << "\nThis program Calculates your Federal Taxes. It calculates" << endl;
cout << "how much you pay if you are single or married." << endl;
cout << "\nIt also allows the user to set up a pension plan if he/she" << endl;
cout << "wishes" << endl;
cout << "Between $0 and $15,000 the tax rate is 15%" << endl;
cout << "Between $15,001 and $40,000 the tax is $2,250 plus 25% taxable" << endl;
cout << "income over $15,000" << endl;
cout << "Over $40,000, the tax is $8,460 plus 35% of the taxable income" << endl;
cout << "over $40,000." << endl;
cout << "When you enter your gross you will be prompted to enter the amount"
cout << "of kids that you have" << endl;
cout << "This will affect how much you have to pay." << endl;
cout << "\nTo get this program started, you must enter you marital status." << endl;
}
char response ()
{
char response;
cout << "Do you want to use this program?";
cin >> response;
return (response);
}
void askgross ()
{
cout << "Enter Your gross income " << endl;
}
void askMaritalStatus ()
{
cout << "Please say whether you are single or married" << endl;
}
void displayInfo (int gross, int position)
{
cout << "\n-this is the information that you inputted-" << endl;
cout << "\nGross income: " << gross << endl;
cout << "Marital Status: " << position << endl;
}
void displayStatus (char MaritalType, GrossType TypeOfGross) // prints the determined shape.
{
switch (GrossType)
{
case LowGross:
cout << "\nSince you make between $0 and $15000 your tax rate is 15%." << endl;
break;
case MedGross:
cout << "\nSince you make between $15001 and $40000 you must pay $2250" << endl;
cout << "in tax money plus 25% of the taxable income over $15000." << endl;
break;
case HighGross:
cout << "\nSince you make over $40000 you must pay $8460" << endl;
cout << "in tax money plus 35% of the taxable income over $40000." << endl;
break;
}
}
void displayRedo ()
{
cout << "\nWould you like to use this program again? Y/N ";
}
tacamount.cpp
#include "FederalTaxheader.h"
double taxAmount(int numPerson, double salary, double amtdeducted, int standardExemption)
{
double taxableIncome, marginalIncome, marginTax;
int tax;
int baseTax, totalTax;
taxableIncome = salary - (1500.00 * numPerson) - amtdeducted - standardExemption;
if (tax >= 0 || tax <= 15000)
{
marginTax =.15 * taxableIncome;
totalTax = marginTax;
}
else if (tax >= 15001 || tax <= 40000)
{
marginalIncome = taxableIncome - 15000;
marginTax = .25 * taxableIncome;
baseTax = 2250;
totalTax = baseTax + marginTax;
}
else if (tax > 40000)
{
marginalIncome = taxableIncome - 40000;
marginTax = .35 * taxableIncome;
baseTax = 8460;
totalTax = baseTax + marginTax;
}
return(totalTax);
}
Many thanks to whoever checks this out. If incase you can't remember what it is that I'm trying to accomplish, it says it in the output file. Thanks again