Working on homework, hit a snag
Hey guys,
I'm in my first year of community college, trying to learn C++ for the first time. I'm running into a snag on my homework though. I've got 99% of the code, but continually get the same error when i try to compile it.
The code is supposed to Ask whether someone is an Instate student. If yes, tuition =
here's the code:
Code:
#include <iostream>
using namespace std;
int main()
{
int numCredHour = 0;
double totTuition = 0;
char letter = ' ';
cout<<"Are You An In-State Student?"<<endl;
cin>>letter;
cout<<"How Many Credit Hours Do You Have?"<<endl;
cin>>numCredHour;
if(toupper(letter) == 'Y'&& numCredHour < 10)
{
totTuition=numCredHour*50;
cout<<"Your Total Tuition is: $"<<totTuition<<endl;
}
else(numCredHour>10);
totTuition=500;
cout<<"Your Total Tuition is: $500"<<endl;
if (toupper(letter) == 'N' && numCredHour<15);
{
totTuition=numCredHour*400;
cout<<"Your Total Tuition is: $"<<totTuition<<endl;
}
else (numCredHour>15);
totTuition=6000;
cout<<"Your Total Tuition is: $6000"<<endl;
system("pause");
return 0;
}
The error code i get is:
Quote:
30 C:\Users\******\Prog1.cpp expected primary-expression before "else"
and
Quote:
30 C:\Users\******\Prog1.cpp expected `;' before "else"
Any ideas as to what might fix my issue would be greatly appreciated. I'll be checking back here every couple of minutes while I work on the next few programs. Thanks for any and all who help!