I'm having problems with displaying the total payment amount in the invoice when I enter courses and with the first step of entering 6 courses that i need to put if i want to try again or not. here is what it's suppose to look like... Please if anyone can help me i would really appreciate it, I need this urgently... Thanks!

Sample Run (The user’s entry is in bold)
Enter the Students Id5656
Enter how many courses-up to 36
Invalid number! Try again
Enter how many courses-up to 33
Enter the 3 course number(s)4587  4599 9696
Sorry, you can’t cumulate more than 7 credit hours
Do you want to try again (Y/N)y
Enter how many courses-up to 32
Enter the 2 course number(s)4587  4599
Thank you!
Press Any Key to Continue...


VALENCIA COMMUNITY COLLEGE
ORLANDO FL 10101
---------------------
Fee Invoice Prepared for Student V5656
1 Credit Hour = $120.25
CRN   CR_PREFIX   CR_HOURS
4587     MAT 236       4     $ 481.00
4599   COP 220       3     $ 360.75


Health & id fees           $  35.00
------------------------------------
Total Payments             $  876.75


CODE:


#include <iostream>
#include <string>
#include <iomanip>
using std::cout;
using std::cin;
using std::string;
using std::transform;
using namespace std;


int main ()
{


double id;
int crn1 = 0;
int crn2 = 0;
int crn3 = 0;
int num;
int course1;
int course2;
int course3;
int hours;
double total1;
double total2;
double total3;
double health_id_fees = 35.00;
double total_payments;
string course_num;
string answer;
string y;
string Y;


//input items


cout <<"Here is the list of all courses Valencia Community College offers: \n\n";
cout <<"\tCRN\t\tCourse Prefix\t\tCredit Hours\n\n";
cout <<"\t4587\t\t  MAT 236\t\t     4\n\n";
cout <<"\t4599\t\t  COP 220\t\t     3\n\n";
cout <<"\t8997\t\t  GOL 124\t\t     1\n\n";
cout <<"\t9696\t\t  COP 100\t\t     3\n\n\n";



cout <<"Enter the Student's Id: ";
cin >>id;
cout <<"\n";


cout <<"Enter how many courses up to 3: ";
cin >>num;
cout <<"\n";



while ( num > 3 )
{


switch (num)
{
case 1 : cout <<"Enter the 1 course number: \n";
cin >> course1;
cout <<"\n";
break;
case 2 : cout <<"Enter the 2 course numbers: \n";
cin >> course1 >> course2;
cout <<"\n";
break;
case 3 : cout <<"Enter the 3 course numbers: \n";
cin >> course1 >> course2 >> course3;
cout <<"\n";
break;
default : cout <<"Invalid number, Try Again: \n\n";


switch (course1, course2, course3)
{
case 4587 : crn1 = 4;
break;
case 4599 : crn1 = 3;
break;
case 8997 : crn1 = 1;
break;
case 9696 : crn1 = 3;
break;
}


while ( course_num == "9696" || course_num == "4599" || course_num == "9696" )
{


cout <<"Sorry, you can't cumulate more than 7 credit hours.\n\nGoodbye!\n\n";
cout<< "Would you like to try again? (Y/N): ";
getline (cin,answer);


if (answer == "y" || answer =="Y")
{
cout <<"Enter how many courses-up to 3: ";
cin >> num;


switch (num)
{
case 1 : cout <<"Enter the 1 course number: \n";
cin >> course1;
break;
case 2 : cout <<"Enter the 2 course numbers: \n";
cin >> course1 >> course2;
break;
case 3 : cout <<"Enter the 3 course numbers: \n";
cin >> course1 >> course2 >> course3;
break;
}
system ("pause");
return 0;
}
}


//calculations


switch (course1, course2, course3)
{
case 4587 : hours = 4;
break;
case 4599 : hours = 3;
break;
case 8997 : hours = 1;
break;
case 9696 : hours = 3;
break;
}


total1 = hours * 120.25;
total2 = hours * 120.25;
total3 = hours * 120.25;
total_payments = total1 + total2 + total3 + health_id_fees ;



//output items


cout <<"Here is the student's fee invoice:\n\n\n\n";


cout <<"\t      VALENCIA COMMUNITY COLLEGE\n\n";
cout <<"\t\t   ORLANDO FL 10101\n\n";
cout <<"\t****************************************";
cout <<"\n\n";


cout <<"\tFee Invoice Prepared for Student V"<<id<<"\n\n\n";


cout << fixed <<setprecision (2);


cout <<"\t1 Credit Hour = $120.25\n\n\n";
cout <<"\tCRN     Course Prefix     Credit Hours\n\n\n";


if ( course1 == 4587 || course1==4599 || course1==8997 || course1==9696 )
{


cout<<"    "<<course1 <<"      ";
switch (course1)
{
case 4587 : cout<<"\t"<<crn1<<"\tMAT 236\t\t4\t $ "<<total3<<"\n\n";
break;
case 4599 : cout<<"\t"<<crn1<<"\tCOP 220\t\t3\t $ "<<total3<<"\n\n";
break;
case 8997 : cout<<"\t"<<crn1<<"\tGOL 124\t\t1\t $ "<<total3<<"\n\n";
break;
case 9696 : cout<<"\t"<<crn1<<"\tCOP 100\t\t3\t $ "<<total3<<"\n\n";
break;
}
}
if ( course2 == 4587 || course2==4599 || course2==8997 || course2==9696 )
{
cout<<"    "<<course2 <<"      ";
switch (course2)
{
case 4587 : cout<<"\t"<<crn2<<"\tMAT 236\t\t4\t $ "<<total3<<"\n\n";
break;
case 4599 : cout<<"\t"<<crn2<<"\tCOP 220\t\t3\t $ "<<total3<<"\n\n";
break;
case 8997 : cout<<"\t"<<crn2<<"\tGOL 124\t\t1\t $ "<<total3<<"\n\n";
break;
case 9696 : cout<<"\t"<<crn2<<"\tCOP 100\t\t3\t $ "<<total3<<"\n\n";
break;
}
}
cout<<"\n";
if (course3 == 4587 || course3==4599 || course3==8997 || course3==9696 )
{
cout<<"    "<<course3 <<"      ";
switch (course3)
{
case 4587 : cout<<"\t"<<crn3<<"\tMAT 236\t\t4\t $ "<<total3<<"\n\n";
break;
case 4599 : cout<<"\t"<<crn3<<"\tCOP 220\t\t3\t $ "<<total3<<"\n\n";
break;
case 8997 : cout<<"\t"<<crn3<<"\tGOL 124\t\t1\t $ "<<total3<<"\n\n";
break;
case 9696 : cout<<"\t"<<crn3<<"\tCOP 100\t\t3\t $ "<<total3<<"\n\n";
break;
}
}
cout <<"\t\tHealth & id fees\t $  "<<health_id_fees<<"\n\n";
cout <<"\t-----------------------------------------\n\n\n";
cout <<"\t\tTotal Payments\t\t $ "<<total_payments<<"\n\n\n";


cout <<"Thank you!! \n\n";



system ("pause");
return 0;
}
}
}

While this:

switch (course1, course2, course3)

May work I doubt it's going to do what you want. Only use one variable name inside the ()s.

I'd rework the program. Have the user to input how many courses they want to take, up to three courses. Accept the user input into an array that holds the user course numbers selected. Then use a loop to determine the number of hours in the course selected, the cost for each course selected and the cost of each course selecte to a running total cost of all courses selected. Once all courses have been priced add other fees etc to the cost of the courses to get the total invoice price. If you want, put all of that in a loop, resetting the varaibles as necessary, to allow more than one student to sign up.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.