Create a program that lets the user enroll a college student. Discounts are given for the in percentage. The user will have unpaid balance if he/she chooses to pay the partial instead of the full payment.
A. Login
Upon loading the program, the user must login to the system:
Username: regi
Password: enroll2015
If the user inputs a wrong username or password, ask the user to try again or to exit.
B. Main Menu
There are 3 choices for the main menu (type a number to choose)
1) REGISTRATION
2) PAYMENT
4) EXIT
C. REGISTRATION Function
Input Student’s Name.
There are 4 choices for the REGISTRATION menu (type a number to choose)
1) Register 5 subjects
2) Register 6 subjects
3) Register 7 subjects
4) Back to Main Menu
Display the following:
Student’s Name
Number of registered subjects
Total number of registered units (3 units per subject)
Total Tuition Fee (Php 700.00 per unit)
D. PAYMENT FUNCTION (allow only if registration is complete)
Input discount percentage.
Display the following:
Student’s Name
Number of registered subjects
Total number of registered units (3 units per subject)
Total Tuition Fee (Php 700.00 per unit)
Total discount in Peso.
Tuition Balance (tuition fee less discount)
Input Payment (payment must not be less than 30% of tuition balance)
Display unpaid balance (tuition balance less payment).
I'm done with the A and B part it works but I have a problem with my C part when I choose between the choices it doesn't work it just says "no such choice".
#include<iostream>
using namespace std;
string studentname[10];
int totaltuition=0;
int numberofsub=0;
int numberofunits=0;
int discount=0;
int tuitionbalance=0;
int payment=0;
int temp=0;
int temp2=0;
double p;
int k=1;
void REGISTRATION() //this is the part I need help
{
int choice;
cin.ignore();
cout<<"Enter the student's name"<<endl;
getline(cin,studentname[k]);
cout<<"1) Register 5 subjects"<<endl
<<"2) Register 6 subjects"<<endl
<<"3) Register 7 subjects"<<endl
<<"4) Back to Main Menu"<<endl
<<"Student's name :"<<"\""<<studentname[k]<<"\""<<endl
<<"Number of registered subjects :"<<numberofsub<<endl
<<"Total number of registered units :"<<numberofunits<<endl
<<"Total Tuition Fee :"<<totaltuition<<endl;
cin>>choice;
cout<<"Successfully went back to main menu"<<endl;
break;
}
default:
cout<<"No such choice"<<endl;
}
}
void PAYMENT()
{
cout<<"Input discount percentage"<<endl;
cin>>p;
cout<<"Enter your payment"<<endl;
cin>>payment;
p=p/100;
discount=totaltuition*p;
tuitionbalance=totaltuition-discount;
temp=tuitionbalance*0.30;
temp2=tuitionbalance-payment;
cout
<<"Student's name :"<<"\""<<studentname[k]<<"\""<<endl
<<"Number of registered subjects :"<<numberofsub<<endl
<<"Total number of registered units :"<<numberofunits<<endl
<<"Total Tuition Fee :"<<totaltuition<<" Php"<<endl
<<"Total discount in Peso :"<<discount<<" Php"<<endl
<<"Tuition Balance :"<<tuitionbalance<<" Php"<<endl;
if(payment>temp)
{
cout<<"Unpaid balance : ";
cout<<temp2<<" Php"<<endl;
totaltuition=temp2;
}
else
{
cout<<"Payment less than 30% of the tuition balance is not accepted"<<endl;
cout<<"Unpaid balance :"<<(tuitionbalance)<<" Php"<<endl;
}
}
int main()
{
int r;
int x;
int y;
string user;
string pass;
string word="enroll2015";
string name="regi";
int ans;