tution program

cant figure out class problem this is what i have so far


The University of Guiness charges $3000 per semester for in-state tuition and $4500 per semester for out-of-state tuition. In addition, room and board is $2500 per semester for in-state students and $3500 per semester for out-of-state students. Write a program that prompts the user for their residential status (i.e., in-state or out-of-state) and whether they require room and board (Y or N). The program should then compute and output their bill for that semester.

#include <iostream>
#include <cmath>
#include <string>
using namespace std;
int main()
{
int answer;
int yes=1;
int no=0;;
int answer2;
int state;
int finala;

cout<<"are you going to be in state yes or no "<<endl;
cin>>answer;

if(answer=1)
{
int it=3000;
}
else if (answer=0);
{
int (ot=4500);
}
else
{
cout<<"invalid answer"<<endl;
}

cout<<"are you living on campus"<<endl;
cin>>answer2;

if(answer2=yes)
{
finala=it+2500;
cout<<"your total is :" <<finala<<endl;
}
else if (answer2==no)
{
finala=ot+3500;
cout<<"your total is: "<<finala<<endl;
}

return 0;


}
Last edited on
Remember that the comparison operator is == not =
Behind an if or else statement there should be no semicolon.
You als can make your life easier by using descriptive variable names like bool in_state, bool room_needed and total_fee.
Topic archived. No new replies allowed.