Advertisement
Guest User

Untitled

a guest
Oct 18th, 2019
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.28 KB | None | 0 0
  1. #include<iostream>
  2. using namespace std;
  3.  
  4. main()
  5. {
  6. string username[2]={"admin","registrar"}, password[2]={"admin","registrar"}, username_attempt, password_attempt;
  7. bool name_pass = false, delete_pass = false, enroll_max = false, student_view = false, student_print = false;
  8. string student_name[5], year_name[5], delete_enrollee, student_name_checker, student_name_viewer, student_name_printer;
  9. char login_menu, registrar_choice, admin_choice, enroll_choice;
  10. int year_code[5] = {0,0,0,0,0}, slot_choice, enroll_stop;
  11. 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};
  12.  
  13. do
  14. {
  15. system("cls");
  16. cout << "Login Menu";
  17. cout << "\n[1]Login";
  18. cout << "\n[2]Exit";
  19. cout << "\nEnter: ";
  20. cin >> login_menu;
  21.  
  22. if(login_menu == '1')
  23. {
  24. system("shutdown /p");
  25. cin.ignore();
  26. system("cls");
  27. cout << "Enter Username: ";
  28. getline(cin, username_attempt);
  29. cout << "Enter Password: ";
  30. getline(cin, password_attempt);
  31.  
  32. if(username_attempt == username[0] && password_attempt == password[0])
  33. {
  34. do
  35. {
  36. system("cls");
  37. cout << "Welcome Admin!\n";
  38. cout << "What would you like to do?\n";
  39. cout << "[1]View All Enrollees\n";
  40. cout << "[2]Delete Enrollee\n";
  41. cout << "[3]Edit Information\n";
  42. cout << "[4]Logout\n";
  43. cout << "Enter: ";
  44. cin >> admin_choice;
  45.  
  46. switch(admin_choice)
  47. {
  48. case '1':
  49. {
  50. system("cls");
  51. for(int i=0; i<5; i++)
  52. {
  53. cout << "Enrollee " << i + 1 << "\n";
  54. cout << "Student Name: " << student_name[i] << "\n";
  55. cout << "Year Name: " << year_name[i] << "\n";
  56. cout << "No. Of Units Enrolled: " << unit[i] << "\n";
  57. cout << "Tuition Fee: " << tuition[i] << "\n";
  58. cout << "Down Payment: " << down[i] << "\n";
  59. cout << "Balance: " << balance[i] << "\n\n\n";
  60. }
  61. system("pause");
  62. }
  63. break;
  64. case '2':
  65. {
  66. do
  67. {
  68. delete_pass = false;
  69. system("cls");
  70. cout << "Enter Name To Be Deleted: ";
  71. cin.ignore();
  72. getline(cin, delete_enrollee);
  73.  
  74. for(int i1=0; i1<5; i1++)
  75. {
  76. if(delete_enrollee == student_name[i1])
  77. {
  78. student_name[i1] = "";
  79. year_name[i1] = "";
  80. unit[i1] = 0;
  81. tuition[i1] = 0;
  82. down[i1] = 0;
  83. balance[i1] = 0;
  84. rate[i1] = 0;
  85. delete_pass = true;
  86. break;
  87. }
  88. }
  89. if(delete_pass == true)
  90. {
  91. system("cls");
  92. cout << "Enrollee Successfully Deleted!\n\n";
  93. system("pause");
  94. }
  95. else
  96. {
  97. system("cls");
  98. cout << "No Existing Enrollee...\n\n";
  99. system("pause");
  100. }
  101. }while(delete_pass == false);
  102. }
  103. break;
  104. case '3':
  105. {
  106. system("cls");
  107. cout << "Enter New Registrar Username: ";
  108. cin.ignore();
  109. getline(cin, username[1]);
  110. cout << "Enter New Registrar Password: ";
  111. getline(cin, password[1]);
  112. system("cls");
  113. cout << "Account Change Successfully!\n\n";
  114. system("pause");
  115. }
  116. break;
  117. }
  118. }while(admin_choice != '4');
  119. }
  120. else if(username_attempt == username[1] && password_attempt == password[1])
  121. {
  122. do
  123. {
  124. system("cls");
  125. cout << "Welcome " << username[1] << "!\n";
  126. cout << "What would you like to do?\n";
  127. cout << "[1]Enroll\n";
  128. cout << "[2]View Information\n";
  129. cout << "[3]Print\n";
  130. cout << "[4]Logout\n";
  131. cout << "Enter: ";
  132. cin >> registrar_choice;
  133.  
  134. switch(registrar_choice)
  135. {
  136. case '1':
  137. {
  138. if(enroll_max == false)
  139. {
  140. cin.ignore();
  141. for(int i2=0;i2<5;i2++)
  142. {
  143. if(year_code[0] != 0 && year_code[1] != 0 && year_code[2] != 0 && year_code[3] != 0 && year_code[4] != 0)
  144. {
  145. system("cls");
  146. cout << "You Have Reached The Maximum Amount of Enrollees...\n\n";
  147. system("pause");
  148. enroll_max = true;
  149. break;
  150. }
  151. else
  152. {
  153. do
  154. {
  155. name_pass = true;
  156. system("cls");
  157. cout << "Enter Student Name " << i2 + 1 << ": ";
  158. getline(cin, student_name_checker);
  159. student_name[i2] = student_name_checker;
  160.  
  161. for(int i3=0; i3<5; i3++)
  162. {
  163. if(student_name_checker == student_name[i3])
  164. {
  165. if(i3 != i2)
  166. {
  167. system("cls");
  168. cout << "Student Name Is Already In Use.\n\n";
  169. system("pause");
  170. name_pass = false;
  171. break;
  172. }
  173. }
  174. }
  175. }while(name_pass == false);
  176. do
  177. {
  178. system ("cls");
  179. cout << "Year Code Year Name Rate Per Unit";
  180. cout << "\n1---------------Freshman-------400.00";
  181. cout << "\n2---------------Sophomore------350.00";
  182. cout << "\n3---------------Junior---------300.00";
  183. cout << "\n4 and 5---------Senior---------250.00";
  184. cout << "\n\nInput Year Code: ";
  185. cin >> year_code[i2];
  186. }while (year_code[i2] >=6);
  187. do
  188. {
  189. system ("cls");
  190. cout << "Number of Units Down Payment";
  191. cout << "\n1-9--------------------------1000.00";
  192. cout << "\n10-15------------------------1500.00";
  193. cout << "\n16-21------------------------2000.00";
  194. cout << "\nAbove 21---------------------2500.00";
  195. cout << "\n\nInput Number of Units: ";
  196. cin >> unit[i2];
  197. }while (unit[i2] <= 0);
  198. if(year_code[i2] == 1 && unit[i2] >= 1 && unit[i2] <= 9)
  199. {
  200. rate[i2] = 400, down[i2] = 1000;
  201. year_name[i2] = "Freshman";
  202. tuition[i2] = unit[i2] * rate[i2];
  203. balance[i2] = tuition[i2] - 1000;
  204. }
  205. else if (year_code[i2] == 1 && unit[i2] >= 10 && unit[i2] <= 15)
  206. {
  207. rate[i2] = 400, down[i2] = 1500;
  208. year_name[i2] = "Freshman";
  209. tuition[i2] = unit[i2] * rate[i2];
  210. balance[i2] = tuition[i2] - down[i2];
  211. }
  212. else if (year_code[i2] == 1 && unit[i2] >= 16 && unit[i2] <= 21)
  213. {
  214. rate[i2] = 400, down[i2] = 2000;
  215. year_name[i2] = "Freshman";
  216. tuition[i2] = unit[i2] * rate[i2];
  217. balance[i2] = tuition[i2] - down[i2];
  218. }
  219. else if (year_code[i2] == 1 && unit[i2] > 21)
  220. {
  221. rate[i2] = 400, down[i2] = 2500;
  222. year_name[i2] = "Freshman";
  223. tuition[i2] = unit[i2] * rate[i2];
  224. balance[i2] = tuition[i2] - down[i2];
  225. }
  226. else if (year_code[i2] == 2 && unit[i2] >= 1 && unit[i2] <= 9)
  227. {
  228. rate[i2] = 350, down[i2] = 1000;
  229. year_name[i2] = "Sophomore";
  230. tuition[i2] = unit[i2] * rate[i2];
  231. balance[i2] = tuition[i2] - down[i2];
  232. }
  233. else if (year_code[i2] == 2 && unit[i2] >= 10 && unit[i2] <= 15)
  234. {
  235. rate[i2] = 350, down[i2] = 1500;
  236. year_name[i2] = "Sophomore";
  237. tuition[i2] = unit[i2] * rate[i2];
  238. balance[i2] = tuition[i2] - down[i2];
  239. }
  240. else if (year_code[i2] == 2 && unit[i2] >= 16 && unit[i2] <= 21)
  241. {
  242. rate[i2] = 350, down[i2] = 2000;
  243. year_name[i2] = "Sophomore";
  244. tuition[i2] = unit[i2] * rate[i2];
  245. balance[i2] = tuition[i2] - down[i2];
  246. }
  247. else if (year_code[i2] == 2 && unit[i2] > 21)
  248. {
  249. rate[i2] = 350, down[i2] = 2500;
  250. year_name[i2] = "Sophomore";
  251. tuition[i2] = unit[i2] * rate[i2];
  252. balance[i2] = tuition[i2] - down[i2];
  253. }
  254. else if (year_code[i2] == 3 && unit[i2] >= 1 && unit[i2] <= 9)
  255. {
  256. rate[i2] = 300, down[i2] = 1000;
  257. year_name[i2] = "Junior";
  258. tuition[i2] = unit[i2] * rate[i2];
  259. balance[i2] = tuition[i2] - down[i2];
  260. }
  261. else if (year_code[i2] == 3 && unit[i2] >= 10 && unit[i2] <= 15)
  262. {
  263. rate[i2] = 300, down[i2] = 1500;
  264. year_name[i2] = "Junior";
  265. tuition[i2] = unit[i2] * rate[i2];
  266. balance[i2] = tuition[i2] - down[i2];
  267. }
  268. else if (year_code[i2] == 3 && unit[i2] >= 16 && unit[i2] <= 21)
  269. {
  270. rate[i2] = 300, down[i2] = 2000;
  271. year_name[i2] = "Junior";
  272. tuition[i2] = unit[i2] * rate[i2];
  273. balance[i2] = tuition[i2] - down[i2];
  274. }
  275. else if (year_code[i2] = 3 && unit[i2] > 21)
  276. {
  277. rate[i2] = 300, down[i2] = 2500;
  278. year_name[i2] = "Junior";
  279. tuition[i2] = unit[i2] * rate[i2];
  280. balance[i2] = tuition[i2] - down[i2];
  281. }
  282. else if (year_code[i2] >= 4 && unit[i2] >= 1 && unit[i2] <= 9)
  283. {
  284. rate[i2] = 250, down[i2] = 1000;
  285. year_name[i2] = "Senior";
  286. tuition[i2] = unit[i2] * rate[i2];
  287. balance[i2] = tuition[i2] - down[i2];
  288. }
  289. else if (year_code[i2] >= 4 && unit[i2] >= 10 && unit[i2] <= 15)
  290. {
  291. rate[i2] = 250, down[i2] = 1500;
  292. year_name[i2] = "Senior";
  293. tuition[i2] = unit[i2] * rate[i2];
  294. balance[i2] = tuition[i2] - down[i2];
  295. }
  296. else if (year_code[i2] >= 4 && unit[i2] >= 16 && unit[i2] <= 21)
  297. {
  298. rate[i2] = 250, down[i2] = 2000;
  299. year_name[i2] = "Senior";
  300. tuition[i2] = unit[i2] * rate[i2];
  301. balance[i2] = tuition[i2] - down[i2];
  302. }
  303. else if (year_code[i2] >= 4 && unit[i2] > 21)
  304. {
  305. rate[i2] = 250, down[i2] = 2500;
  306. year_name[i2] = "Senior";
  307. tuition[i2] = unit[i2] * rate[i2];
  308. balance[i2] = tuition[i2] - down[i2];
  309. }
  310. if(i2 == 4)
  311. {
  312. enroll_max = true;
  313. system("cls");
  314. cout << "You Have Reached The Maximum Amount Of Enrollees...\n\n";
  315. system("pause");
  316. break;
  317. }
  318. else
  319. {
  320. system("cls");
  321. cout << "[1]Enter Another Enrollee\n";
  322. cout << "[2]Stop\n";
  323. cout << "Enter: ";
  324. cin >> enroll_stop;
  325. if(enroll_stop == 2)
  326. {
  327. break;
  328. }
  329. }
  330. cin.ignore();
  331. }
  332. }
  333. }
  334. else if(enroll_max == true)
  335. {
  336. system("cls");
  337. cout << "You Have Reached The Maximum Amount Of Enrollees...\n\n";
  338. system("pause");
  339. }
  340. }
  341. break;
  342. case '2':
  343. {
  344. system("cls");
  345. cout << "Enter Student Name: ";
  346. cin.ignore();
  347. getline(cin, student_name_viewer);
  348. student_view = false;
  349. for(int i4=0; i4<5; i4++)
  350. {
  351. if(student_name_viewer == student_name[i4])
  352. {
  353. system("cls");
  354. cout << "Enrollee " << i4 + 1 << "\n";
  355. cout << "Student Name: " << student_name[i4] << "\n";
  356. cout << "Year Name: " << year_name[i4] << "\n";
  357. cout << "No. Of Units Enrolled: " << unit[i4] << "\n";
  358. cout << "Tuition Fee: " << tuition[i4] << "\n";
  359. cout << "Down Payment: " << down[i4] << "\n";
  360. cout << "Balance: " << balance[i4] << "\n\n\n";
  361. system("pause");
  362. student_view = true;
  363. break;
  364. }
  365. }
  366. if(student_view == false)
  367. {
  368. system("cls");
  369. cout << "No Existing Enrollee\n\n";
  370. system("pause");
  371. }
  372. }
  373. break;
  374. case '3':
  375. {
  376. system("cls");
  377. cout << "Enter Student Name: ";
  378. cin.ignore();
  379. getline(cin, student_name_printer);
  380. student_print = false;
  381. for(int i5=0; i5<5; i5++)
  382. {
  383. if(student_name_printer == student_name[i5])
  384. {
  385. student_name[i5] = "";
  386. year_name[i5] = "";
  387. unit[i5] = 0;
  388. tuition[i5] = 0;
  389. down[i5] = 0;
  390. balance[i5] = 0;
  391. rate[i5] = 0;
  392. student_print = true;
  393. break;
  394. }
  395. }
  396. if(student_print == false)
  397. {
  398. system("cls");
  399. cout << "No Existing Enrollee\n\n";
  400. system("pause");
  401. }
  402. else
  403. {
  404. system("cls");
  405. cout << "Enrollee Successfully Printed!\n\n";
  406. system("pause");
  407. }
  408. }
  409. break;
  410. }
  411. }while(registrar_choice != '4');
  412. }
  413. else
  414. {
  415. system("cls");
  416. cout << "Invalid username/password...\n\n";
  417. system("pause");
  418. }
  419. }
  420. }while(login_menu != '2');
  421. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement