Tuition Program-NEED HELP!

Hi everyone, well i need help. I've never done any programming ever and well i need help to finish an assignment. Here are the requirments for this code:
Assignment:
The charges for college tuition are $75 per credit hour or $950 per semester if full-time (12 or more credit hours). In addition, a student who is majoring in computer science (major code ‘C’) is assessed a $25 per semester laboratory fee; those majoring in other laboratory sciences (major code ‘O’) pay a $35 fee. Other majors, each with a unique major code, pay no laboratory fee. Out-of-state students are assessed an additional fee of 20% of base tuition charge only. There is also, a $15 registration fee for everyone.
For example, a student who is designated in-state, is carrying 15 credits, and is majoring in biology (major code ‘O’) will be charged $1000 for tuition: $950 for full-time status, $35 laboratory fee, and $15 registration fee.
A student taking 10 credits who has out-of-state status and is a computer science major (major code ‘C’) will be charged $940, which is $750 based on 10 credits at $75 per credit hour, $150 out-of-state fee (20% of $750) plus a $25 laboratory fee and $15 registration fee.
1. Develop an algorithm (using a flowchart) to compute the cost of attending college given the following inputs:
a) number of credit hours
b) Major Code
‘C’ or ‘c’ - computer science major
‘O’ or ‘o’ - other laboratory sciences
anything else - other majors
c) Residency status
1 – In State
2 – Out of State

Here is my program so far, it might need some work, any advice would be appreciated.
#include <iostream>
#include <iomanip.h>

using namespace std;

void main()
{
// declare constants
const double FULL_TIME_RATE = 950; // fulltime student = $950
const double MAJOR_CODE_C_RATE = 25; // computer science major = $25
const double MAJOR_CODE_O_RATE = 35; // laboratory science major = $35
const double REG_FEE = 15; // registration fee for every student = $15
const double OUT_STATE_CHARGE = 0.20; // out of state charge = 20%
const double IN_STATE = 0; // In_state charge = 0
const double CREDIT_PRICE = 75; // per credit hour = 75

// Variable
double credit_hour; //credit hours taken
char major_code; // 'C' computer scienc or 'O' laboratory science
char residency; // '1' in state or '2' out of state

// Calculation Variable
double lab_fee;
double residency_fee;
double registration_fee;
double extra_charge;

// Output Variable
double tuition_cost;

cout << "Please enter your credit hours: ";
cin >> credit_hour;

cout << "Enter major code ('C' - computer science or 'L' - Lab. science): ";
cin >> major_code;

cout << "Please enter your residency ('1' - In State or '2' - Out of state) ";
cin >> residency;

if (major_code == 'C' || major_code == 'c')
{
lab_fee = MAJOR_CODE_C_RATE;
registration_fee = REG_FEE;
}
else
{
lab_fee = MAJOR_CODE_O_RATE;
registration_fee = REG_FEE;
}

if (residency == '2')
{
residency_fee = OUT_STATE_CHARGE;
}
else
{
residency_fee = IN_STATE;
}

//calculate
if ( credit_hour < 12 )
{
credit_hour * CREDIT_PRICE;
}
else
{
FULL_TIME_RATE;
}

//calculate total tuition
credit_hour + lab_fee + residency_fee + registration_fee * OUT_STATE_CHARGE;

//Output
cout.setf(ios::fixed, ios::floatfield);
cout.setf(ios::showpoint);
cout << endl << endl << setprecision(2) //set decimal point
cout << "Tuition cost: $" << endl << endl;

system("pause");
}
Everytime i go to compile this code it gives me an error, im missing a semi colon. can anyone help
Use [code][/code] tags.
Copy+paste the error from your compiler.
The semicolon problem is on line 76. See 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
#include <iostream>
#include <iomanip.h>

using namespace std;

void main()
{
	// declare constants
	const double FULL_TIME_RATE = 950; // fulltime student = $950
	const double MAJOR_CODE_C_RATE = 25; // computer science major = $25
	const double MAJOR_CODE_O_RATE = 35; // laboratory science major = $35
	const double REG_FEE = 15; // registration fee for every student = $15
	const double OUT_STATE_CHARGE = 0.20; // out of state charge = 20%
	const double IN_STATE = 0; // In_state charge = 0
	const double CREDIT_PRICE = 75; // per credit hour = 75

	// Variable
	double credit_hour; //credit hours taken
	char major_code; // 'C' computer scienc or 'O' laboratory science
	char residency; // '1' in state or '2' out of state

	// Calculation Variable
	double lab_fee;
	double residency_fee;
	double registration_fee;
	double extra_charge;

	// Output Variable
	double tuition_cost;

	cout << "Please enter your credit hours: ";
	cin >> credit_hour;

	cout << "Enter major code ('C' - computer science or 'L' - Lab. science): ";
	cin >> major_code;

	cout << "Please enter your residency ('1' - In State or '2' - Out of state) ";
	cin >> residency;

	if (major_code == 'C' || major_code == 'c')
	{
		lab_fee = MAJOR_CODE_C_RATE;
		registration_fee = REG_FEE;
	}
	else
	{
		lab_fee = MAJOR_CODE_O_RATE;
		registration_fee = REG_FEE;
	}

	if (residency == '2')
	{
		residency_fee = OUT_STATE_CHARGE;
	}
	else
	{
		residency_fee = IN_STATE;
	}

	//calculate
	if ( credit_hour < 12 )
	{
		credit_hour * CREDIT_PRICE;
	}
	else
	{
		FULL_TIME_RATE;
	}

	//calculate total tuition
	credit_hour + lab_fee + residency_fee + registration_fee * OUT_STATE_CHARGE;

	//Output
	cout.setf(ios::fixed, ios::floatfield);
	cout.setf(ios::showpoint);
	cout << endl << endl << setprecision(2) //set decimal point
	cout << "Tuition cost: $" << endl << endl;
}


You may also wish to look at 63, 67, and 71. You are doing some calculations, but not storing the result anywhere.
Last edited on
And if it says you're missing a semicolon, you should probably just go to the line the error points you to and put a semicolon there. It IS possible that this is not the actual error, but in most cases it is.
well for line 71 i had the output calculation as: tuition_cost=credit_hour + lab_fee + residency_fee + registration_fee * OUT_STATE_CHARGE;

and it giving me an error, tution_cost held no value in my statement.
Error E2379 C:\Users\Ben\Desktop\New Borland\college3.cpp 80: Statement missing ; in function main()
Warning W8004 C:\Users\Ben\Desktop\New Borland\college3.cpp 83: 'tuition_cost' is assigned a value that is never used in function main()
*** 1 errors in Compile ***

Tool completed with exit code 1

This is the error i get.
Notice that if you read the error, it says that in file "college3.cpp", on line 80, you are missing a semicolon.

There is also a warning. Warnings will allow the program to compile, but indicate you may have a problem running it. The warning says that on line 83, you assign a value to "tuition_cost", but then never use it anywhere.
Topic archived. No new replies allowed.