1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135
|
#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(char,char,char,char);
int main()
{
double wages=0.0, interest=0.0, dividends=0.0, otherIncome = 0.0, taxOwed = 0.0, totIncome =0.0;
int noDep=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( );
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(char single,char marriedJoint, char marriedSeperate, char singleHead)
{
printf("SINGLE %d\nMARRIED JOINT %d\nMARRIED SEPERATE %d\nSINGLE HEAD %d\n",single,marriedJoint,marriedSeperate,singleHead);
}
|