Code:
#include<stdlib.h>
#include<stdio.h>
#include<iostream>
#include<string>
using namespace std;
double getDouble(char prompt[30]);
int getchar(char prompt[30]);
void printReport(int);
int main()
{
double wages=0.0, interest=0.0, dividends=0.0, otherIncome = 0.0, taxOwed = 0.0, totIncome =0.0;
int noDep=0,processed=0;
char status[4];
double taxes[7][5]={
{2.8, 0.0, 2.3, 0.0},
{7.5, 5.2, 7.2, 3.8},
{9.6, 8.3, 8.9, 7.4},
{13.5, 12.2, 13.1, 11.0},
{15.5, 14.6, 15.2,13.8},
{17.4, 16.3, 17.2, 15.4}
};
int t;
int i;
for(t=0; t<7; t++);
for(i=0; i<5; i++);
{
printf("%.2f", taxes[t][i]);
}
printf("Welcome to the Income Tax Calculator \n\n");
printf("Filing Status \n S = single\n MJ = married filing joint\n MS = married filing seperate\n SH = single head of household\n Q = quit\n");
while(strcmp(status, "Q")!= 0)
{
printf("Enter your filing status: ");
scanf_s("%3s", &status,4);
//printf("You entered %s\n", status);
printf("Enter your amount of Wages:$ ");
scanf_s("%lf",&wages);
//printf("You entered %lf\n", wages);
printf("Enter amount of interest:$ ");
scanf_s("%lf",&interest);
//printf("You entered %lf\n", interest);
printf("Enter amount of Dividends:$ ");
scanf_s("%lf",÷nds);
//printf("You entered %lf\n", dividends);
printf("Enter amount of any other income:$ ");
scanf_s("%lf",&otherIncome);
//printf("You entered %lf\n", otherIncome);
printf("Enter number of Dependents: ");
scanf_s("%2d",&noDep);
//printf("You entered %d\n", noDep);
totIncome = (wages + interest + dividends + otherIncome) - (noDep * 2800);
printf("Total Income:$ %.2f\n",totIncome);
if(totIncome <= 6000)
{
printf("Tax owed: %.2f\n",taxes[t][i]);
}
else if( totIncome > 6001 && totIncome < 10000)
{
printf("Tax owed: %.2f\n",taxes[t][i]);
}
else if(totIncome > 10001 && totIncome <= 15000)
{
printf("Tax owed: %.2f\n",taxes[t][i]);
}
else if(totIncome > 15001 && totIncome <= 20000)
{
printf("Tax owed: %.2f\n",taxes[t][i]);
}
else if(totIncome > 20001 && totIncome <= 25000)
{
printf("Tax owed: %.2f\n",taxes[t][i]);
}
else if(totIncome > 25001 && totIncome <= 30000)
{
printf("Tax owed: %.2f\n",taxes[t][i]);
}
else if (totIncome >= 30001)
{
taxOwed = totIncome * .35;
printf("Tax owed: %.2f\n",taxOwed);
}
}
system("pause");
printReport(processed);
return 0;
}
double getDouble(char prompt[30])
{
double d;
char buffer[30];
printf("%c", prompt);
gets_s(buffer);
d = atof(buffer);
return d;
}
int getchar(char prompt[30])
{
int i;
char buffer[30];
printf("%s", prompt);
gets_s(buffer);
i = atoi(buffer);
return i;
}
int getint(char prompt[30])
{
int i;
char buffer[30];
printf("%d", prompt);
gets_s(buffer);
i = atoi(buffer);
return i;
}
void printReport(int processed)
{
printf("SINGLE %d\nMARRIED JOINT %d\nMARRIED SEPERATE %d\nSINGLE HEAD %d\n");
}
Comment