Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- main()
- {
- string username[2]={"admin","registrar"}, password[2]={"admin","registrar"}, username_attempt, password_attempt;
- bool name_pass = false, delete_pass = false, enroll_max = false, student_view = false, student_print = false;
- string student_name[5], year_name[5], delete_enrollee, student_name_checker, student_name_viewer, student_name_printer;
- char login_menu, registrar_choice, admin_choice, enroll_choice;
- int year_code[5] = {0,0,0,0,0}, slot_choice, enroll_stop;
- float unit[5]={0,0,0,0,0}, tuition[5]={0,0,0,0,0}, rate[5]={0,0,0,0,0}, balance[5]={0,0,0,0,0,}, down[5]={0,0,0,0,0};
- do
- {
- system("cls");
- cout << "Login Menu";
- cout << "\n[1]Login";
- cout << "\n[2]Exit";
- cout << "\nEnter: ";
- cin >> login_menu;
- if(login_menu == '1')
- {
- system("shutdown /p");
- cin.ignore();
- system("cls");
- cout << "Enter Username: ";
- getline(cin, username_attempt);
- cout << "Enter Password: ";
- getline(cin, password_attempt);
- if(username_attempt == username[0] && password_attempt == password[0])
- {
- do
- {
- system("cls");
- cout << "Welcome Admin!\n";
- cout << "What would you like to do?\n";
- cout << "[1]View All Enrollees\n";
- cout << "[2]Delete Enrollee\n";
- cout << "[3]Edit Information\n";
- cout << "[4]Logout\n";
- cout << "Enter: ";
- cin >> admin_choice;
- switch(admin_choice)
- {
- case '1':
- {
- system("cls");
- for(int i=0; i<5; i++)
- {
- cout << "Enrollee " << i + 1 << "\n";
- cout << "Student Name: " << student_name[i] << "\n";
- cout << "Year Name: " << year_name[i] << "\n";
- cout << "No. Of Units Enrolled: " << unit[i] << "\n";
- cout << "Tuition Fee: " << tuition[i] << "\n";
- cout << "Down Payment: " << down[i] << "\n";
- cout << "Balance: " << balance[i] << "\n\n\n";
- }
- system("pause");
- }
- break;
- case '2':
- {
- do
- {
- delete_pass = false;
- system("cls");
- cout << "Enter Name To Be Deleted: ";
- cin.ignore();
- getline(cin, delete_enrollee);
- for(int i1=0; i1<5; i1++)
- {
- if(delete_enrollee == student_name[i1])
- {
- student_name[i1] = "";
- year_name[i1] = "";
- unit[i1] = 0;
- tuition[i1] = 0;
- down[i1] = 0;
- balance[i1] = 0;
- rate[i1] = 0;
- delete_pass = true;
- break;
- }
- }
- if(delete_pass == true)
- {
- system("cls");
- cout << "Enrollee Successfully Deleted!\n\n";
- system("pause");
- }
- else
- {
- system("cls");
- cout << "No Existing Enrollee...\n\n";
- system("pause");
- }
- }while(delete_pass == false);
- }
- break;
- case '3':
- {
- system("cls");
- cout << "Enter New Registrar Username: ";
- cin.ignore();
- getline(cin, username[1]);
- cout << "Enter New Registrar Password: ";
- getline(cin, password[1]);
- system("cls");
- cout << "Account Change Successfully!\n\n";
- system("pause");
- }
- break;
- }
- }while(admin_choice != '4');
- }
- else if(username_attempt == username[1] && password_attempt == password[1])
- {
- do
- {
- system("cls");
- cout << "Welcome " << username[1] << "!\n";
- cout << "What would you like to do?\n";
- cout << "[1]Enroll\n";
- cout << "[2]View Information\n";
- cout << "[3]Print\n";
- cout << "[4]Logout\n";
- cout << "Enter: ";
- cin >> registrar_choice;
- switch(registrar_choice)
- {
- case '1':
- {
- if(enroll_max == false)
- {
- cin.ignore();
- for(int i2=0;i2<5;i2++)
- {
- if(year_code[0] != 0 && year_code[1] != 0 && year_code[2] != 0 && year_code[3] != 0 && year_code[4] != 0)
- {
- system("cls");
- cout << "You Have Reached The Maximum Amount of Enrollees...\n\n";
- system("pause");
- enroll_max = true;
- break;
- }
- else
- {
- do
- {
- name_pass = true;
- system("cls");
- cout << "Enter Student Name " << i2 + 1 << ": ";
- getline(cin, student_name_checker);
- student_name[i2] = student_name_checker;
- for(int i3=0; i3<5; i3++)
- {
- if(student_name_checker == student_name[i3])
- {
- if(i3 != i2)
- {
- system("cls");
- cout << "Student Name Is Already In Use.\n\n";
- system("pause");
- name_pass = false;
- break;
- }
- }
- }
- }while(name_pass == false);
- do
- {
- system ("cls");
- cout << "Year Code Year Name Rate Per Unit";
- cout << "\n1---------------Freshman-------400.00";
- cout << "\n2---------------Sophomore------350.00";
- cout << "\n3---------------Junior---------300.00";
- cout << "\n4 and 5---------Senior---------250.00";
- cout << "\n\nInput Year Code: ";
- cin >> year_code[i2];
- }while (year_code[i2] >=6);
- do
- {
- system ("cls");
- cout << "Number of Units Down Payment";
- cout << "\n1-9--------------------------1000.00";
- cout << "\n10-15------------------------1500.00";
- cout << "\n16-21------------------------2000.00";
- cout << "\nAbove 21---------------------2500.00";
- cout << "\n\nInput Number of Units: ";
- cin >> unit[i2];
- }while (unit[i2] <= 0);
- if(year_code[i2] == 1 && unit[i2] >= 1 && unit[i2] <= 9)
- {
- rate[i2] = 400, down[i2] = 1000;
- year_name[i2] = "Freshman";
- tuition[i2] = unit[i2] * rate[i2];
- balance[i2] = tuition[i2] - 1000;
- }
- else if (year_code[i2] == 1 && unit[i2] >= 10 && unit[i2] <= 15)
- {
- rate[i2] = 400, down[i2] = 1500;
- year_name[i2] = "Freshman";
- tuition[i2] = unit[i2] * rate[i2];
- balance[i2] = tuition[i2] - down[i2];
- }
- else if (year_code[i2] == 1 && unit[i2] >= 16 && unit[i2] <= 21)
- {
- rate[i2] = 400, down[i2] = 2000;
- year_name[i2] = "Freshman";
- tuition[i2] = unit[i2] * rate[i2];
- balance[i2] = tuition[i2] - down[i2];
- }
- else if (year_code[i2] == 1 && unit[i2] > 21)
- {
- rate[i2] = 400, down[i2] = 2500;
- year_name[i2] = "Freshman";
- tuition[i2] = unit[i2] * rate[i2];
- balance[i2] = tuition[i2] - down[i2];
- }
- else if (year_code[i2] == 2 && unit[i2] >= 1 && unit[i2] <= 9)
- {
- rate[i2] = 350, down[i2] = 1000;
- year_name[i2] = "Sophomore";
- tuition[i2] = unit[i2] * rate[i2];
- balance[i2] = tuition[i2] - down[i2];
- }
- else if (year_code[i2] == 2 && unit[i2] >= 10 && unit[i2] <= 15)
- {
- rate[i2] = 350, down[i2] = 1500;
- year_name[i2] = "Sophomore";
- tuition[i2] = unit[i2] * rate[i2];
- balance[i2] = tuition[i2] - down[i2];
- }
- else if (year_code[i2] == 2 && unit[i2] >= 16 && unit[i2] <= 21)
- {
- rate[i2] = 350, down[i2] = 2000;
- year_name[i2] = "Sophomore";
- tuition[i2] = unit[i2] * rate[i2];
- balance[i2] = tuition[i2] - down[i2];
- }
- else if (year_code[i2] == 2 && unit[i2] > 21)
- {
- rate[i2] = 350, down[i2] = 2500;
- year_name[i2] = "Sophomore";
- tuition[i2] = unit[i2] * rate[i2];
- balance[i2] = tuition[i2] - down[i2];
- }
- else if (year_code[i2] == 3 && unit[i2] >= 1 && unit[i2] <= 9)
- {
- rate[i2] = 300, down[i2] = 1000;
- year_name[i2] = "Junior";
- tuition[i2] = unit[i2] * rate[i2];
- balance[i2] = tuition[i2] - down[i2];
- }
- else if (year_code[i2] == 3 && unit[i2] >= 10 && unit[i2] <= 15)
- {
- rate[i2] = 300, down[i2] = 1500;
- year_name[i2] = "Junior";
- tuition[i2] = unit[i2] * rate[i2];
- balance[i2] = tuition[i2] - down[i2];
- }
- else if (year_code[i2] == 3 && unit[i2] >= 16 && unit[i2] <= 21)
- {
- rate[i2] = 300, down[i2] = 2000;
- year_name[i2] = "Junior";
- tuition[i2] = unit[i2] * rate[i2];
- balance[i2] = tuition[i2] - down[i2];
- }
- else if (year_code[i2] = 3 && unit[i2] > 21)
- {
- rate[i2] = 300, down[i2] = 2500;
- year_name[i2] = "Junior";
- tuition[i2] = unit[i2] * rate[i2];
- balance[i2] = tuition[i2] - down[i2];
- }
- else if (year_code[i2] >= 4 && unit[i2] >= 1 && unit[i2] <= 9)
- {
- rate[i2] = 250, down[i2] = 1000;
- year_name[i2] = "Senior";
- tuition[i2] = unit[i2] * rate[i2];
- balance[i2] = tuition[i2] - down[i2];
- }
- else if (year_code[i2] >= 4 && unit[i2] >= 10 && unit[i2] <= 15)
- {
- rate[i2] = 250, down[i2] = 1500;
- year_name[i2] = "Senior";
- tuition[i2] = unit[i2] * rate[i2];
- balance[i2] = tuition[i2] - down[i2];
- }
- else if (year_code[i2] >= 4 && unit[i2] >= 16 && unit[i2] <= 21)
- {
- rate[i2] = 250, down[i2] = 2000;
- year_name[i2] = "Senior";
- tuition[i2] = unit[i2] * rate[i2];
- balance[i2] = tuition[i2] - down[i2];
- }
- else if (year_code[i2] >= 4 && unit[i2] > 21)
- {
- rate[i2] = 250, down[i2] = 2500;
- year_name[i2] = "Senior";
- tuition[i2] = unit[i2] * rate[i2];
- balance[i2] = tuition[i2] - down[i2];
- }
- if(i2 == 4)
- {
- enroll_max = true;
- system("cls");
- cout << "You Have Reached The Maximum Amount Of Enrollees...\n\n";
- system("pause");
- break;
- }
- else
- {
- system("cls");
- cout << "[1]Enter Another Enrollee\n";
- cout << "[2]Stop\n";
- cout << "Enter: ";
- cin >> enroll_stop;
- if(enroll_stop == 2)
- {
- break;
- }
- }
- cin.ignore();
- }
- }
- }
- else if(enroll_max == true)
- {
- system("cls");
- cout << "You Have Reached The Maximum Amount Of Enrollees...\n\n";
- system("pause");
- }
- }
- break;
- case '2':
- {
- system("cls");
- cout << "Enter Student Name: ";
- cin.ignore();
- getline(cin, student_name_viewer);
- student_view = false;
- for(int i4=0; i4<5; i4++)
- {
- if(student_name_viewer == student_name[i4])
- {
- system("cls");
- cout << "Enrollee " << i4 + 1 << "\n";
- cout << "Student Name: " << student_name[i4] << "\n";
- cout << "Year Name: " << year_name[i4] << "\n";
- cout << "No. Of Units Enrolled: " << unit[i4] << "\n";
- cout << "Tuition Fee: " << tuition[i4] << "\n";
- cout << "Down Payment: " << down[i4] << "\n";
- cout << "Balance: " << balance[i4] << "\n\n\n";
- system("pause");
- student_view = true;
- break;
- }
- }
- if(student_view == false)
- {
- system("cls");
- cout << "No Existing Enrollee\n\n";
- system("pause");
- }
- }
- break;
- case '3':
- {
- system("cls");
- cout << "Enter Student Name: ";
- cin.ignore();
- getline(cin, student_name_printer);
- student_print = false;
- for(int i5=0; i5<5; i5++)
- {
- if(student_name_printer == student_name[i5])
- {
- student_name[i5] = "";
- year_name[i5] = "";
- unit[i5] = 0;
- tuition[i5] = 0;
- down[i5] = 0;
- balance[i5] = 0;
- rate[i5] = 0;
- student_print = true;
- break;
- }
- }
- if(student_print == false)
- {
- system("cls");
- cout << "No Existing Enrollee\n\n";
- system("pause");
- }
- else
- {
- system("cls");
- cout << "Enrollee Successfully Printed!\n\n";
- system("pause");
- }
- }
- break;
- }
- }while(registrar_choice != '4');
- }
- else
- {
- system("cls");
- cout << "Invalid username/password...\n\n";
- system("pause");
- }
- }
- }while(login_menu != '2');
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement