Why are my if statements not executing correctly?

When I run this program, the if statements are not executing correctly. For example, if I enter 2 exemptions claimed, 78000 for adjusted gross income, and filing status 1, it not only outputs the correct answer, but also the equations for married joint max. Which is filing status 2. If someone could take a quick look at this and help me out I would greatly appreciate it!

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
141
142
143
144
145
146
147
#include <iostream>
#include <cmath>
#include <iomanip>
#include <cctype>
using namespace std;

const double SINGLE_MAX = 254200;
const double MARRIED_JOINT_MAX = 305050;
const double MARRIED_SEPERATE_MAX = 152525;
const double HEAD_MAX = 279650;
const double MAX_PER_EXEMPT = 3950;
const double IS_LINE_FIVE_MORE = 122500;
const double DIVISION_FOR_SINGLE = 2500;
const double DIVISION_FOR_SEPERATE = 1250;

double isLineFive(double lineFiveAmount, int filingStatusFunc);
int main()
{
	int exemptClaim;
	double adjGroIncome;
	double paidOut;
	int filingStatus;
	double agiOver;
	double exemptCalc;
	double lineSeven;
	double lineEight;
	double lineNine;
	
	
	cout << "Enter number of exemptions claimed:   " ;
	cin >> exemptClaim;
	cout << endl << endl;
	
	cout << "Enter your Adjusted Gross Income (1040, line 38) :   ";
	cin >> adjGroIncome;
	cout << endl << endl;
	
	cout << "1 - Single" << endl;
	cout << "2 - Married, Filing Jointly" << endl;
	cout << "3 - Head of Household" << endl;
	cout << "4 - Qualifying Widow(er)" << endl;
	cout << "5 - Married, Filing Seperately" << endl;
	
	cout << "Enter your filing status from above (1-5):   " ;
	cin >> filingStatus ;
	cout << endl;
	
	//Single Max

	if (( filingStatus == 1 ) && (adjGroIncome < SINGLE_MAX))
	{
	
		paidOut = MAX_PER_EXEMPT * exemptClaim;
		cout << "1.   AGI is not over filing status amount" << endl;
		cout << "2.   Exemptions claimed ( " << exemptClaim << " x " << MAX_PER_EXEMPT << 
		"):" << setw(15) << paidOut << endl << endl;
		cout << "***Enter amount from worksheet line 2 on form 1040 line 42" << endl;
 	}
	
	if ((( filingStatus == 1 ) && (adjGroIncome > SINGLE_MAX)) && (agiOver > IS_LINE_FIVE_MORE))
	{
	
		paidOut = (MAX_PER_EXEMPT * exemptClaim);
		agiOver = (adjGroIncome - SINGLE_MAX);
		cout << "AGI is too high. No exemptions allowed." << endl;
	}
	if ((agiOver < IS_LINE_FIVE_MORE) && (( filingStatus == 1 ) && (adjGroIncome > SINGLE_MAX)))
	{
	
		exemptCalc = isLineFive(agiOver, filingStatus);
		lineSeven = (exemptCalc * .02);
		lineEight = (lineSeven * paidOut);
		lineNine = (lineEight - paidOut);
		cout << "1.   AGI is over filing status amount" << endl;
		cout << "2.   Exemptions claimed ( " << exemptClaim << " x " << MAX_PER_EXEMPT << 
		"):" << setw(15) << paidOut << endl << endl;
		cout << "3.   Adjusted gross income:" << setw(15) << adjGroIncome << endl;
		cout << "4.   Filing status limit (single):" << setw(15) << SINGLE_MAX << endl;
		cout << "-------------------------------------------------------------------" << endl;
		cout << "5.   AGI amount over limit:" << setw(15) << agiOver << endl;
		cout << "6.   Division result:" << setw(15) << exemptCalc << endl;
		cout << "-------------------------------------------------------------------" << endl;
		cout << "7.   Multiply line 6 by 2%:" << setw(15) << lineSeven << endl;
		cout << "8.   Multiply line 2 by line 7:" << setw(15) << lineEight << endl;
		cout << "-------------------------------------------------------------------" << endl;
		cout << "9. Subtract line 8 from line 2:" << setw(15) << lineNine << endl;
	}

	
	// Married Joint MAX

	if (( filingStatus == 2 ) && (adjGroIncome < MARRIED_JOINT_MAX))
	{
		paidOut = MAX_PER_EXEMPT * exemptClaim;
		cout << "1.   AGI is not over filing status amount" << endl;
		cout << "2.   Exemptions claimed ( " << exemptClaim << " x " << MAX_PER_EXEMPT << 
		"):" << setw(15) << paidOut << endl << endl;
		cout << "***Enter amount from worksheet line 2 on form 1040 line 42" << endl;
	}
	
	if ((( filingStatus == 2 ) && (adjGroIncome > MARRIED_JOINT_MAX)) && (agiOver > IS_LINE_FIVE_MORE))
	{
	
		paidOut = (MAX_PER_EXEMPT * exemptClaim);
		agiOver = (adjGroIncome - MARRIED_JOINT_MAX);

		cout << "AGI is too high. You cannot take a deductions for exemptions." << endl;
		cout << "Exit, and do not complete the rest of this worksheet." << endl;
	}
	if (((filingStatus == 2 ) && (agiOver < IS_LINE_FIVE_MORE)) && (adjGroIncome > MARRIED_JOINT_MAX));
	{
		lineSeven = (exemptCalc * .02);
		lineEight = (lineSeven * paidOut);
		lineNine = (lineEight - paidOut);
	
		cout << "1.   AGI is over filing status amount" << endl;
		cout << "2.   Exemptions claimed ( " << exemptClaim << " x " << MAX_PER_EXEMPT << 
		"):" << setw(15) << paidOut << endl << endl;
	
		cout << "3.   Adjusted gross income:" << setw(15) << adjGroIncome << endl;
		cout << "4.   Filing status limit (Married Joint):" << setw(15) << MARRIED_JOINT_MAX << endl;
		cout << "-------------------------------------------------------------------" << endl;
		cout << "5.   AGI amount over limit:" << setw(15) << agiOver << endl;
		cout << "6.   Division result:" << setw(15) << exemptCalc << endl;
		cout << "-------------------------------------------------------------------" << endl;
		cout << "7.   Multiply line 6 by 2%:" << setw(15) << lineSeven << endl;
		cout << "8.   Multiply line 2 by line 7:" << setw(15) << lineEight << endl;
		cout << "-------------------------------------------------------------------" << endl;
		cout << "9. Subtract line 8 from line 2:" << setw(15) << lineNine << endl;
	}
	
 cout << endl << endl;
 system ("PAUSE");
 
 return 0;
}

double isLineFive(double lineFiveAmount, int filingStatusFunc)
{	if ((filingStatusFunc == 1) || (filingStatusFunc == 2) || (filingStatusFunc == 3)
		|| (filingStatusFunc == 4))
	return( lineFiveAmount / DIVISION_FOR_SINGLE );
			lineFiveAmount = ceil(lineFiveAmount);
	if (filingStatusFunc == 5)
	return( lineFiveAmount / DIVISION_FOR_SEPERATE );
			lineFiveAmount = ceil(lineFiveAmount);
			
}	
Last edited on
You have a semi colon at the end of the if on line 110.
Topic archived. No new replies allowed.