hiya,
Basically your logic is completely wrong.
Example:
say you enter you age as 30.
then you say amount is 30,001.
Look at the first condition you assess: elseif (amount > 60001 || age < 19 || age < 56 )
because you are using or operators it only takes one of the above three conditions to evaluate to true for the whole if statement to evaluate to true. So 30,001 is NOT greater than 60,001, so you're expecting it to move onto the next if. BUT it also says evaluate to true if you age is less that 56, which it is, and therefore you get card A.
by the way these 2 together make no sense: age < 19 || age < 56
because if a number is less than 19, it is of course always less that 56.
You've already tested for the minimum age of 20, so you don't event need the <19 test.
@evgeric. You have mixed up the OR and AND. Your if statements shoud look like this -
1 2 3 4 5 6 7 8 9 10 11
if (amount < 30000)
cout << "Your entered annual amount is too low for a credit card, please re-enter...";
elseif (amount > 60001 && age < 19 && age < 56)
cout << "Your are eligible for Card A.";
elseif (amount > 60000 && age > 55)
cout << "Your are eligible for Card B.";
elseif (amount > 30000 && amount < 60001 && age > 20 && age < 55)
cout << "Your are eligible for Card C.";
elseif (amount > 30000 && amount < 60001 && age > 55)
cout << "Your are eligible for Card D.";
You should be using && for AND instead of || for OR.
Think about it. for a Card C. you write that the user should be older than 20 OR younger than 55. Thats pretty much every age ever. 10 is younger than 55, so that contradicts the age > 20.
Nah, i didnt say that.
As a first pass, do it in a convoluted way, just to get it working.
by that I mean look at your requirements:
1 2 3 4
Greater than $60000, Age Group: 20 to 55 = Card A
Greater than $60000, Age Group: Above 55 = Card B
Between $30000 and $60000, Age Group: 20 to 55 = Card C
Between $30000 and $60000, Age Group: Above 55 = Card D