As Zereo said, we can't read your code well, or tell how it's formatted if you don't use code tags.
Fixed all the issues I could find and left my debugging steps in so you could see what I did to fix it. Took longer than necessary because you didn't have code tags and your code wasn't formatted.
changed find1 and status to strings.
changed void main to int main
changed if(status='Y') (status == "Y")
changed if(find1='Y') (find1 == "Y")
and moved a } maybe more than one.
You need to change one of your if statements to include someone who is 25. Right now your using
if(age>25) or if(age<25)
.
Your also using only upper case Y or N, so you might want to tell the user to enter in upper case or check for both Y and y.
I know it's messy because of all the // Test code, but that's all you need to do to fix most program issues. 1. format your code, 2. put in a few cout commands to test if your if statements are working.
My recommendation is in the future, write your program logic first, meaning your if/else/while statements. Once you get the logic working the way you want, then add the input/output/math.
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
|
#include <iostream>
#include <conio.h>
using namespace std;
int age;
float wage;
float work;
string find1;
string status;
int main(void)
{
cout<<"Please enter your age or the oldest persons age if applying as a couple ";
cin>>age;
cout<<"What is your yearly wage(combined wages for a couple)? ";
cin>>wage;
cout<<"Are Your applying for working Tax credit as a couple?(Y/N) ";
cin>>status;
cout<<"How many hours do you work per week(person who works most hours for a couple)?";
cin>>work;
// Test
if (status == "Y")
{cout << " Y " << status << endl;}
else
if (status == "N")
{cout << " N " << status << endl;}
else
{cout << " Unkn " << status << endl;}
// Test
if (age>25)
{cout << "age = " << age << endl;}
if (work>30)
{cout << "work = " << work << endl;}
if (wage<16300)
{cout << "wage = " << wage << endl;}
cout << age << " " << wage << " " << status << " " << work << endl;
if (status == "N")
{
// Test
cout << "Status = No" << endl;
if(age<25 && work>30 && wage<11700)
{
cout<<"You are eligable for Working Tax Credits, Would you like to find out how much? (Y/N)";
cin>>find1;
}
if(find1=="Y")
{
if(wage<=8612)
{
cout<<"You are eligable for "<<char(156)<<"1180 ";
}
else
if(wage>8613 && wage<11700)
{
cout<<"You are eligable for "<<char(156)<< "665";
}
}
}
if (status == "Y")
{
// test
cout << "Status = Yes" << endl;
if (age>25)
{cout << age << endl;}
if (work>30)
{cout << work << endl;}
if (wage<16300)
{cout << wage << endl;}
if(age>25 && work>30 && wage<16300)
{
cout<<"You are eligable for Working Tax Credits, Would you like to find out how much? (Y/N)";
cin>>find1;
}
if(find1 == "Y")
{
if(wage<=8612)
{
cout<<"You are eligable for "<<char(156)<< "2880 ";
}
else if(wage>8612 && wage<11700)
{
cout<<"You are eligable for "<<char(156)<< "2370";
}
else if(wage>11700 && wage<12000)
{
cout<<"You are eligable for "<<char(156)<< "1630";
}
else if(wage>12000 && wage<14000)
{
cout<<"You are eligable for "<<char(156)<< "890";
}
else if(wage>14000 && wage<16300)
{
cout<<"You are eligable for "<<char(156)<< "150";
}
}
else
{
cout<<"You are not eligable for working tax credits";
}
}
}
|