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
136
137
138
139
140
#include <stdio.h>
int get_status();
int get_income();
float sort(int, int);
float single (int);
float MFJ (int);
float MFS (int);
float HOH (int);
void exit();
void display(float);
int main()
{
int status, income;
float tax;
while ((status = get_status()) != 5)
{
income = get_income();
tax = sort(status, income);
display(tax);
}
return 0;
}
int get_status()
{
int temp;
printf ("1)Single 2)Married Filing Jointly 3)Married Filing Separately 4)Head of Household 5)Exit");
printf (" Please enter filing status? ");
scanf ("%d", &temp);
if (temp == 5)
exit();
return (temp);
}
int get_income()
{
int temp;
printf ("Enter your taxable income: $");
scanf ("%d", &temp);
return (temp);
}
float sort(int status, int income)
{
if (status == 1)
return (single(income));
else if (status == 2)
return (MFJ(income));
else if (status == 3)
return (MFS(income));
else if (status == 4)
return (HOH(income));
else
{
printf ("You must enter 1-4 or 5 to Exit");
get_status();
}
}
float single(int income)
{
float temp;
if (income > 0 && income <= 24000)
temp = income * 0.15;
else if (income > 24000 && income <= 58000)
temp = 3600 + 0.28 * (income - 24000);
else if (income > 58000 && income <= 121300)
temp = 13162 + 0.31 * (income - 58000);
else if (income > 121300 && income <= 263750)
temp = 32738.5 + 0.36 * (income - 121300);
else if (income > 263750)
temp = 84020.5 + 0.396 * (income - 263750);
return temp;
}
float MFJ(int income)
{
float temp;
if (income > 0 && income <= 40100)
temp = 0.15 * income;
else if (income > 40100 && income <= 96900)
temp = 6015 + 0.28 * (income - 40100);
else if (income > 96900 && income <= 147700)
temp = 21919 + 0.31 * (income - 96900);
else if (income > 147700 && income <= 263750)
temp = 37667 + 0.36 * (income - 147700);
else if (income > 263750)
temp = 79445 + 0.396 * (income - 263750);
return temp;
}
float MFS(int income)
{
float temp;
if (income > 0 && income <= 20050)
temp = 0.15 * income;
else if (income > 20050 && income <= 48450)
temp = 3007.5 + 0.28 * (income - 20050);
else if (income > 48450 && income <= 73850)
temp = 10959 + 0.31 * (income - 48450);
else if (income > 73850 && income <= 131875)
temp = 18833.5 + 0.36 * (income - 73850);
else if (income > 131875)
temp = 39722.5 + 0.396 * (income - 131875);
return temp;
}
float HOH(int income)
{
float temp;
if (income > 0 && income <= 32150)
temp = 0.15 * income;
else if (income > 32150 && income <= 83050)
temp = 4822 + 0.28 * (income - 32150);
else if (income > 83050 && income <= 134500)
temp = 19074 + 0.31 * (income - 83050);
else if (income > 134500 && income <= 263750)
temp = 35074 + 0.36 * (income - 134500);
else if (income > 263750)
temp = 81554 + 0.396 * (income - 263750);
return temp;
}
void exit()
{
printf ("Tax program exited…");
}
void display(float tax)
{
printf ("The taxes owed are: $%.2f ", tax);
}
cs


초보자한테는 이것도 아주 힘들었어용


하루가 꼬박걸렸답니다


이제 남은건 두개의 경고뿐인데 도와주실수 있으신가용?