Advertisement
Guest User

Untitled

a guest
Dec 7th, 2019
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 71.95 KB | None | 0 0
  1. package app;
  2.  
  3. import java.util.*;
  4. import java.io.*;
  5.  
  6. public class Main
  7. {
  8. public static void main(String[] args)throws FileNotFoundException
  9. {
  10. try
  11. {
  12. dataStruct ds = new dataStruct();
  13. PrintWriter out = new PrintWriter("Final_project.dat");
  14.  
  15. Scanner in = new Scanner(System.in);
  16.  
  17. String n, sfn, sln, m, c, lect, lf, ll, lq;
  18. int sId, lId , opt;
  19.  
  20. String sl = " ";
  21. String st = " ";
  22. String sd = " ";
  23.  
  24. String d = " ";
  25. String l = " ";
  26. String t = " ";
  27.  
  28. String llab = " ";
  29. String lt = " ";
  30. String lday = " ";
  31.  
  32. int choice = 0;
  33. int num = 0;
  34. int num2 = 0;
  35. int num3 = 0;
  36. int data = 0;
  37. String Data = " ";
  38. do
  39. {
  40. System.out.println("\n------WELCOME-----=");
  41. System.out.println("\n1. ADD A NEW CLASS ENTRY");
  42. System.out.println("\n-------------------");
  43. System.out.println("\n2. ADD A NEW EMPLOYEE");
  44. System.out.println("\n-------------------");
  45. System.out.println("\n3. DELETE AN ENRTY");
  46. System.out.println("\n-------------------");
  47. System.out.println("\n4. UPDATE AN ENTRY");
  48. System.out.println("\n-------------------");
  49. System.out.println("\n5. VIEW ALL ENTRYS");
  50. System.out.println("\n-------------------");
  51. System.out.println("\n6. SEARCH AN ENTRY");
  52. System.out.println("\n-------------------");
  53. System.out.println("\n7. VIEW LAB SCHEDULES FOR CR");
  54. System.out.println("\n-------------------");
  55. System.out.println("\n8. HELP GUIDE");
  56. System.out.println("\n-------------------");
  57. System.out.println("\n9. EXIT");
  58. System.out.println("\n-------------------");
  59.  
  60. choice = in.nextInt();
  61.  
  62. switch (choice)
  63. {//start switch case
  64. case 1:
  65. System.out.println("\nYOU HAVE SELECTED TO ADD A CLASS...");
  66. do
  67. {//start do - while loop
  68. System.out.println("\nEnter The Class Code (e.g CPTR250)");
  69. c = in.next();
  70. System.out.println("\nEnter Ther Class Name ");
  71. in.nextLine();
  72. n = in.nextLine();
  73. System.out.println("\nOn what day is the Class Held?");
  74. System.out.println("\n 1. Monday & Wednesday"
  75. + "\n2. Tuesday & Thursday");
  76. num3 = in.nextInt();
  77. if (num < 3)
  78. {//start if loop
  79. if (num3 <=2)
  80. {//start if loop
  81. if (num3 == 1)
  82. {//start if loop
  83. d = "Monday & Wednesday";
  84. }//end if loop
  85. else
  86. {//start else
  87. d = "Tuesday & Thursday";
  88. }//end else
  89. }//end if
  90. }//end if
  91. else
  92. {//start else
  93. System.err.println("\nERROR!!! Please Enter a number between 1 - 7");
  94. }//end else
  95. System.out.println("\nAt what time is this Class supposed to commence?");
  96. System.out.println("\n1. 8:00 AM - 9:15 AM"
  97. + "\n2. 9:25 AM - 10:40 AM"
  98. + "\n3. 10:50 AM - 12:05 AM"
  99. + "\n4. 12:15 AM - 1:30 PM"
  100. + "\n5. 1:40 PM - 2:55 PM"
  101. + "\n6. 3:05 PM - 4:20 PM"
  102. + "\n7. 4:30 PM - 5:45 PM"
  103. + "\n8. 5:55 PM - 7:10 PM"
  104. + "\n9. 7:20 PM - 8:35 PM");
  105. num2 = in.nextInt();
  106. if (num2 < 10)
  107. {//start if
  108. if (num2 <= 5)
  109. {//starts if num is less than or equal to five
  110. if (num2 <= 2)
  111. {//starts if num is less than or equal to two
  112. if (num2 == 1)
  113. {//starts if
  114. t = "8:00 AM - 9:15 AM";
  115. }//ends if
  116. else
  117. {//starts else
  118. t = "9:25 AM - 10:40 AM";
  119. }//ends else
  120. }
  121. if (num2 >= 3 && num2 <= 5)
  122. {//starts if num is more than or equal to three and less than or equal to five
  123. if (num == 3)
  124. {//starts if
  125. t = "10:50 AM - 12:05 AM";
  126. }//ends if
  127. else if (num == 4)
  128. {//starts else if
  129. t = "12:15 AM - 1:30 PM";
  130. }//ends else if
  131. else
  132. {//starts else
  133. t = "1:40 PM - 2:55 PM";
  134. }//ends else
  135. }//ends if
  136.  
  137. }//ends if
  138. else
  139. {//starts else
  140. if (num2 >= 6 && num2 <= 7)
  141. {//starts if num is more than or equal to five and less than or equal to seven
  142. if (num == 6)
  143. {//starts if
  144. t = "3:05 PM - 4:20 PM";
  145. }//ends if
  146. else
  147. {//starts else
  148. t = "4:30 PM - 5:45 PM";
  149. }//ends else
  150. }//ends else
  151. else
  152. {
  153. if (num == 8)
  154. {//start if
  155. t = "5:55 PM - 7:10 PM";
  156. }//end if
  157. else
  158. {//start else
  159. t = "7:20 PM - 8:35 PM";
  160. }//end else
  161. }
  162. }//end else
  163. }//end if
  164. else
  165. {//start else...error handling
  166. System.err.println("\nERROR!!! Please enter a number between 1 - 9....");
  167. }//end else
  168. System.out.println("\nEnter The CLass Lecturer (e.g. Mr. Pooneassieh");
  169. in.nextLine();
  170. lect = in.nextLine();
  171. System.out.println("\nWhich lab is this class supposed to be held in?");
  172. System.out.println("\n1. NBCL \n2. CSL \n3. CR");
  173. num = in.nextInt();
  174. if (num < 4)
  175. {//start if
  176. if (num == 1)
  177. {//start if
  178. l = "NBCL";
  179. }//end if
  180. else
  181. {//start else
  182. if (num == 2)
  183. {//start if
  184. l = "CSL";
  185. }//end if
  186. else
  187. {//start else
  188. l = "CR";
  189. }//end else
  190.  
  191. }//end else
  192. }//end if
  193. else
  194. {//error handling
  195. System.err.println("\nERROR!!! Enter a number from 1 - 3 please...");
  196. }
  197. ds.addClass(n, c, lect, d, t, l);
  198. System.out.println("\nWould You like to return to Main menu? \n1. No, I want to add another Class \t2. Yes, I want to return to Main menu");
  199. opt = in.nextInt();
  200. if (opt == 2)
  201. {//start if
  202. System.out.println("\nReturning to Main.....");
  203. }//end if
  204. else if (opt == 1)
  205. {//start else if
  206. System.err.println("\nAdding another class...");
  207. }//end else if
  208. else
  209. {// error handling
  210. System.err.println("ERRORR...enter a number between 1 & 2....");
  211. }
  212. }//end do
  213. while (opt < 2);
  214. break;
  215. case 2:
  216. System.out.println("\nYOU HAVE SELECETED TO ADD A NEW EMPLOYEE...");
  217. do
  218. {//start do - while
  219. System.out.println("\n\tWhat type of employee would you like to add...");
  220. System.out.println("\n\t\t1. Student Worker");
  221. System.out.println("\n\t\t2. Lab Technician");
  222. num = in.nextInt();
  223. if (num < 3)
  224. {// start if
  225. if (num == 1)
  226. {//start if
  227. System.out.println("\nEnter the Student's First name (e.g Jerry)");
  228. sfn = in.next();
  229. System.out.println("\nEnter the Student's Last name (e.g Doe)");
  230. sln = in.next();
  231. System.out.println("\nEnter the Student's ID number (e.g. 29839731982)");
  232. sId = in.nextInt();
  233. System.out.println("\nOn what day will this Student be assigned to the Lab?");
  234. System.out.println("\n 1. Monday & Wednesday"
  235. + "\n2. Tuesday & Thursday"
  236. + "\n3. Monday ONLY"
  237. + "\n4. Tuesday ONLY"
  238. + "\n5. Wednesday ONLY"
  239. + "\n6. Thursday ONLY"
  240. + "\n7. Everyday");
  241. num3 = in.nextInt();
  242. if (num3 < 8)
  243. {//start if
  244. if (num3 <= 4)
  245. {//start if
  246. if (num3 <=2)
  247. {//start if
  248. if (num3 == 1)
  249. {//start if
  250. sd = "Monday & Wednesday";
  251. }//end if
  252. else
  253. {//start else
  254. sd = "Tuesday & Thursday";
  255. }//end else
  256. }//end if
  257. else
  258. {//start else
  259. if (num3 == 3)
  260. {//start if
  261. sd = "Monday";
  262. }//end if
  263. else
  264. {//start else
  265. sd = "Tuesday";
  266. }// end else
  267. }//end else
  268. }//end if
  269. else
  270. {// start else
  271. if (num3 >= 5 && num3 <= 7)
  272. {//start if
  273. if (num3 == 5)
  274. {//start if
  275. sd = "Wednesday";
  276. }// end if
  277. else if (num3 == 6)
  278. {//start else if
  279. sd = "Thursday";
  280. }//end else if
  281. else
  282. {//start else
  283. sd = "Everyday";
  284. }//end else
  285. }//end if
  286. }//end else
  287. }//end if
  288. else
  289. {//error handling
  290. System.err.println("\nERROR!!! Please Enter a number between 1 - 7");
  291. }
  292. System.out.println("\nWhat time will this Student be assigned to the lab?");
  293. System.out.println("\n1. 8:00 AM - 9:15 AM"
  294. + "\n2. 9:25 AM - 10:40 AM"
  295. + "\n3. 10:50 AM - 12:05 AM"
  296. + "\n4. 12:15 AM - 1:30 PM"
  297. + "\n5. 1:40 PM - 2:55 PM"
  298. + "\n6. 3:05 PM - 4:20 PM"
  299. + "\n7. 4:30 PM - 5:45 PM"
  300. + "\n8. 5:55 PM - 7:10 PM"
  301. + "\n9. 7:20 PM - 8:35 PM");
  302. num2 = in.nextInt();
  303. if (num2 < 10)
  304. {//start if
  305. if (num2 <= 5)
  306. {//start if
  307. if (num2 <= 2)
  308. {//start if
  309. if (num2 == 1)
  310. {//start if
  311. st = "8:00 AM - 9:15 AM";
  312. }//end if
  313. else
  314. {//start else
  315. st = "9:25 AM - 10:40 AM";
  316. }//end else
  317. }//end if
  318. if (num2 >= 3 && num2 <= 5)
  319. {//start if
  320. if (num == 3)
  321. {//start if
  322. st = "10:50 AM - 12:05 AM";
  323. }//end if
  324. else if (num == 4)
  325. {//start else if
  326. st = "12:15 AM - 1:30 PM";
  327. }//end else if
  328. else
  329. {//start if
  330. st = "1:40 PM - 2:55 PM";
  331. }//end else
  332. }//end if
  333.  
  334. }//end if
  335. else
  336. {//start else
  337. if (num2 >= 6 && num2 <= 7)
  338. {//start if
  339. if (num == 6)
  340. {// start if
  341. st = "3:05 PM - 4:20 PM";
  342. }// end if
  343. else
  344. {//start else
  345. st = "4:30 PM - 5:45 PM";
  346. }//end else
  347. }//end if
  348. else
  349. {//start else
  350. if (num == 8)
  351. {//start if
  352. st = "5:55 PM - 7:10 PM";
  353. }//end if
  354. else
  355. {//start else
  356. st = "7:20 PM - 8:35 PM";
  357. }//end else
  358. }//end else
  359. }//end else
  360. }//end if
  361. else
  362. {//error handleing
  363.  
  364. System.err.println("\nERROR!!! Please enter a number between 1 - 9....");
  365. }
  366. System.out.println("\nWhich lab is this Student supposed to be assigned to?");
  367. System.out.println("\n1. NBCL \n2. CSL \n3. CR \n4. HWL \n5. LL");
  368. num = in.nextInt();
  369. if (num < 6)
  370. {
  371. if (num <=2)
  372. {
  373. if (num == 1)
  374. {
  375. sl = "NBCL";
  376. }
  377. else
  378. {
  379. sl = "CSL";
  380. }
  381. }
  382. else
  383. {
  384. if (num >=3 && num <= 5)
  385. {
  386. if (num == 3)
  387. {
  388. sl = "CR";
  389. }
  390. else if (num == 4)
  391. {
  392. sl= "HWL";
  393. }
  394. else
  395. {
  396. sl = "LL";
  397. }
  398. }
  399. }
  400. }
  401. else
  402. {
  403. System.err.println("\nERROR!!! Enter a number from 1 - 5 please...");
  404. }
  405. System.out.println("\nEnter the Students Major (e.g. Computer Science)");
  406. in.nextLine();
  407. m = in.nextLine();
  408.  
  409. if (sl == l || sl == llab)
  410. {
  411. if (sd == d || sl == lday)
  412. {
  413. if (st == t || sl == lt)
  414. {
  415. System.err.println("\nERROR!!!... There is a either a Class at that day and time in that lab, or a Lab Tech is already posted there on that day and time at that lab...");
  416. }
  417. else
  418. System.out.println("\nSucess...");
  419. ds.addStudent(sfn, sln, sId, sl, sd, st, m);
  420. }
  421. else
  422. {
  423. System.out.println("\nSucess....");
  424. ds.addStudent(sfn, sln, sId, sl, sd, st, m);
  425. }
  426. }
  427. else
  428. {
  429. System.out.println("\nSucess...");
  430. ds.addStudent(sfn, sln, sId, sl, sd, st, m);
  431. }
  432. }
  433. else
  434. {
  435. System.out.println("\nEnter the Lab Tech's First name (e.g. John)");
  436. lf = in.next();
  437. System.out.println("\nEnter the Lab Tech's Last name (e.g. Springer)");
  438. ll = in.next();
  439. System.out.println("\nEnter the Lab Tech's Staff ID number (e.g 19732910123)");
  440. lId = in.nextInt();
  441. System.out.println("\nOn what day will this Lab Tech be in the Lab?");
  442. System.out.println("\n 1. Monday & Wednesday"
  443. + "\n2. Tuesday & Thursday"
  444. + "\n3. Monday ONLY"
  445. + "\n4. Tuesday ONLY"
  446. + "\n5. Wednesday ONLY"
  447. + "\n6. Thursday ONLY"
  448. + "\n7. Everyday");
  449. num3 = in.nextInt();
  450. if (num3 < 8)
  451. {
  452. if (num3 <= 4)
  453. {
  454. if (num3 <=2)
  455. {
  456. if (num3 == 1)
  457. {
  458. lday = "Monday & Wednesday";
  459. }
  460. else
  461. lday = "Tuesday & Thursday";
  462. }
  463. else
  464. {
  465. if (num3 == 3)
  466. {
  467. lday = "Monday";
  468. }
  469. else
  470. {
  471. lday = "Tuesday";
  472. }
  473. }
  474. }
  475. else
  476. {
  477. if (num3 >= 5 && num3 <= 7)
  478. {
  479. if (num3 == 5)
  480. {
  481. lday = "Wednesday";
  482. }
  483. else if (num3 == 6)
  484. {
  485. lday = "Thursday";
  486. }
  487. else
  488. {
  489. lday = "Everyday";
  490. }
  491. }
  492. }
  493. }
  494. else
  495. {
  496. System.err.println("\nERROR!!! Please Enter a number between 1 - 7");
  497. }
  498. System.out.println("\nAt what time will this Lab Tech be in the Lab?");
  499. System.out.println("\n1. 8:00 AM - 9:15 AM"
  500. + "\n2. 9:25 AM - 10:40 AM"
  501. + "\n3. 10:50 AM - 12:05 AM"
  502. + "\n4. 12:15 AM - 1:30 PM"
  503. + "\n5. 1:40 PM - 2:55 PM"
  504. + "\n6. 3:05 PM - 4:20 PM"
  505. + "\n7. 4:30 PM - 5:45 PM"
  506. + "\n8. 5:55 PM - 7:10 PM"
  507. + "\n9. 7:20 PM - 8:35 PM");
  508. num2 = in.nextInt();
  509. if (num2 < 10)
  510. {
  511. if (num2 <= 5)
  512. {
  513. if (num2 <= 2)
  514. {
  515. if (num2 == 1)
  516. {
  517. lt = "8:00 AM - 9:15 AM";
  518. }
  519. else
  520. {
  521. lt = "9:25 AM - 10:40 AM";
  522. }
  523. }
  524. if (num2 >= 3 && num2 <= 5)
  525. {
  526. if (num == 3)
  527. {
  528. lt = "10:50 AM - 12:05 AM";
  529. }
  530. if (num == 4)
  531. {
  532. lt = "12:15 AM - 1:30 PM";
  533. }
  534. else if (num == 5)
  535. {
  536. lt = "1:40 PM - 2:55 PM";
  537. }
  538. }
  539.  
  540. }
  541. else
  542. {
  543. if (num2 >= 6 && num2 <= 7)
  544. {
  545. if (num == 6)
  546. {
  547. lt = "3:05 PM - 4:20 PM";
  548. }
  549. else
  550. {
  551. lt = "4:30 PM - 5:45 PM";
  552. }
  553. }
  554. else
  555. {
  556. if (num == 8)
  557. {
  558. lt = "5:55 PM - 7:10 PM";
  559. }
  560. else
  561. {
  562. lt = "7:20 PM - 8:35 PM";
  563. }
  564. }
  565. }
  566. }
  567. else
  568. {
  569. System.err.println("\nERROR!!! Please enter a number between 1 - 9....");
  570. }
  571. System.out.println("\nWhich lab is this Student supposed to be assigned to?");
  572. System.out.println("\n1. NBCL \n2. CSL \n3. CR \n4. HWL \n5. LL");
  573. num = in.nextInt();
  574. if (num < 6)
  575. {
  576. if (num <=2)
  577. {
  578. if (num == 1)
  579. {
  580. llab = "NBCL";
  581. }
  582. else
  583. {
  584. llab = "CSL";
  585. }
  586. }
  587. else
  588. {
  589. if (num >=3 && num <= 5)
  590. {
  591. if (num == 3)
  592. {
  593. llab = "CR";
  594. }
  595. else if (num == 4)
  596. {
  597. llab = "HWL";
  598. }
  599. else
  600. {
  601. llab = "LL";
  602. }
  603. }
  604. }
  605. }
  606. else
  607. {
  608. System.err.println("\nERROR!!! Enter a number from 1 - 5 please...");
  609. }
  610. System.out.println("\nEnter the Lab Tech's Highest Qualifications (e.g. Degree in Computer Science)");
  611. in.nextLine();
  612. lq = in.nextLine();
  613. if (llab == l)
  614. {
  615. if (lday == d)
  616. {
  617. if (lt == t)
  618. {
  619. System.err.println("\nError!!! There is a class at that day and time in that lab...");
  620. }
  621. else
  622. {
  623. System.out.println("\nSucess...");
  624. ds.addLabTech(lf, ll, lId, llab, lday, lt, lq);
  625. }
  626. }
  627. else
  628. {
  629. System.out.println("\nSucess...");
  630. ds.addLabTech(lf, ll, lId, llab, lday, lt, lq);
  631. }
  632. }
  633. else
  634. {
  635. System.out.println("\nSucess...");
  636. ds.addLabTech(lf, ll, lId, llab, lday, lt, lq);
  637. }
  638. }
  639. }
  640. else
  641. {
  642. System.err.println("\nERROR!!!YOU MUST ENTER EITHER 1 OR 2...");
  643. }
  644. System.out.println("\nWould You Like to Add another Employee? \n1.Yes I would... \n2.No...I want to return to the menu");
  645. num = in.nextInt();
  646. }
  647. while (num <2);
  648. if (num == 2)
  649. {
  650. System.out.println("\nReturning to Main....");
  651. }
  652. else
  653. {
  654. System.err.println("\nAdding another employee...");
  655. }
  656. break;
  657. case 3:
  658. System.out.println("\nYou have selected to Delete an entry...");
  659. while (num < 2)
  660. {
  661. if (num <3)
  662. {
  663. System.out.println("\nWhat type of entry would you like to delete? \n\n1. Class\n2. Student Worker\n3. Lab Technician");
  664. num = in.nextInt();
  665. if (num == 1)
  666. {
  667. System.out.println("\nEnter the Course Code of the Class you would like to delete...");
  668. Data = in.next();
  669. ds.deleteCLass(Data);
  670. }
  671. else
  672. {
  673. if (num == 2)
  674. {
  675. System.out.println("\nEnter the ID number of the Student Worker you would like to delete...");
  676. data = in.nextInt();
  677. ds.deleteStudent(data);
  678. }
  679. else
  680. {
  681. System.out.println("\nEnter the Staff ID number of the Lab Technician you would like to delete...");
  682. data = in.nextInt();
  683. ds.deleteLab(data);
  684. }
  685. }
  686. }
  687. else
  688. {
  689. System.err.println("\nERRORR!!!!!!\nINVALID NUMBER...\nENTER A NUMBER AMONG THE FOLLOWING \t 1,2, OR 3");
  690. }
  691. System.out.println("\nWould You Like to delete another Employee? \n1.Yes I would... \n2.No...I want to return to the menu");
  692. }
  693. break;
  694. case 4:
  695. System.out.println("\nYou have selected to Update an Entry...");
  696. System.out.println("\nWhat type of Entry would you like to Update?");
  697. System.out.println("\n1. Class \n2. Student Worker \n3. Lab Tech");
  698. opt = in.nextInt();
  699. if (opt <= 3)
  700. {
  701. if (opt == 1)
  702. {
  703. System.out.println("\nEnter The Class Code (e.g CPTR250)");
  704. c = in.next();
  705. System.out.println("\nEnter Ther Class Name ");
  706. in.nextLine();
  707. n = in.nextLine();
  708. System.out.println("\nOn what day is the Class Held?");
  709. System.out.println("\n 1. Monday & Wednesday"
  710. + "\n2. Tuesday & Thursday");
  711. num3 = in.nextInt();
  712. if (num < 3)
  713. {//start if loop
  714. if (num3 <=2)
  715. {//start if loop
  716. if (num3 == 1)
  717. {//start if loop
  718. d = "Monday & Wednesday";
  719. }//end if loop
  720. else
  721. {//start else
  722. d = "Tuesday & Thursday";
  723. }//end else
  724. }//end if
  725. }//end if
  726. else
  727. {//start else
  728. System.err.println("\nERROR!!! Please Enter a number between 1 - 7");
  729. }//end else
  730. System.out.println("\nAt what time is this Class supposed to commence?");
  731. System.out.println("\n1. 8:00 AM - 9:15 AM"
  732. + "\n2. 9:25 AM - 10:40 AM"
  733. + "\n3. 10:50 AM - 12:05 AM"
  734. + "\n4. 12:15 AM - 1:30 PM"
  735. + "\n5. 1:40 PM - 2:55 PM"
  736. + "\n6. 3:05 PM - 4:20 PM"
  737. + "\n7. 4:30 PM - 5:45 PM"
  738. + "\n8. 5:55 PM - 7:10 PM"
  739. + "\n9. 7:20 PM - 8:35 PM");
  740. num2 = in.nextInt();
  741. if (num2 < 10)
  742. {//start if
  743. if (num2 <= 5)
  744. {//starts if num is less than or equal to five
  745. if (num2 <= 2)
  746. {//starts if num is less than or equal to two
  747. if (num2 == 1)
  748. {//starts if
  749. t = "8:00 AM - 9:15 AM";
  750. }//ends if
  751. else
  752. {//starts else
  753. t = "9:25 AM - 10:40 AM";
  754. }//ends else
  755. }
  756. if (num2 >= 3 && num2 <= 5)
  757. {//starts if num is more than or equal to three and less than or equal to five
  758. if (num == 3)
  759. {//starts if
  760. t = "10:50 AM - 12:05 AM";
  761. }//ends if
  762. else if (num == 4)
  763. {//starts else if
  764. t = "12:15 AM - 1:30 PM";
  765. }//ends else if
  766. else
  767. {//starts else
  768. t = "1:40 PM - 2:55 PM";
  769. }//ends else
  770. }//ends if
  771.  
  772. }//ends if
  773. else
  774. {//starts else
  775. if (num2 >= 6 && num2 <= 7)
  776. {//starts if num is more than or equal to five and less than or equal to seven
  777. if (num == 6)
  778. {//starts if
  779. t = "3:05 PM - 4:20 PM";
  780. }//ends if
  781. else
  782. {//starts else
  783. t = "4:30 PM - 5:45 PM";
  784. }//ends else
  785. }//ends else
  786. else
  787. {
  788. if (num == 8)
  789. {//start if
  790. t = "5:55 PM - 7:10 PM";
  791. }//end if
  792. else
  793. {//start else
  794. t = "7:20 PM - 8:35 PM";
  795. }//end else
  796. }
  797. }//end else
  798. }//end if
  799. else
  800. {//start else...error handling
  801. System.err.println("\nERROR!!! Please enter a number between 1 - 9....");
  802. }//end else
  803. System.out.println("\nEnter The CLass Lecturer (e.g. Mr. Pooneassieh");
  804. in.nextLine();
  805. lect = in.nextLine();
  806. System.out.println("\nWhich lab is this class supposed to be held in?");
  807. System.out.println("\n1. NBCL \n2. CSL \n3. CR");
  808. num = in.nextInt();
  809. if (num < 4)
  810. {//start if
  811. if (num == 1)
  812. {//start if
  813. l = "NBCL";
  814. }//end if
  815. else
  816. {//start else
  817. if (num == 2)
  818. {//start if
  819. l = "CSL";
  820. }//end if
  821. else
  822. {//start else
  823. l = "CR";
  824. }//end else
  825.  
  826. }//end else
  827. }//end if
  828. else
  829. {//error handling
  830. System.err.println("\nERROR!!! Enter a number from 1 - 3 please...");
  831. }
  832.  
  833.  
  834. System.out.println("\nAre you sure you want to update the entry?");
  835. System.out.println("\n1. Yes,Update now... \t2. No, Dont update...");
  836. opt = in.nextInt();
  837. if (opt == 1)
  838. {
  839. System.out.println("\nSucess...");
  840. ds.updateClass(Data, n, c, lect, d, t, l);
  841. }
  842. else
  843. {
  844. System.out.println("\nExiting update....");
  845. }
  846.  
  847.  
  848. }
  849.  
  850. else if (opt == 2)
  851. {
  852. System.out.println("\n\tWhat type of employee would you like to add...");
  853. System.out.println("\n\t\t1. Student Worker");
  854. System.out.println("\n\t\t2. Lab Technician");
  855. num = in.nextInt();
  856. if (num < 2 && num > 0)
  857. {// start if
  858. if (num == 1)
  859. {//start if
  860. System.out.println("\nEnter the Student's First name (e.g Jerry)");
  861. sfn = in.next();
  862. System.out.println("\nEnter the Student's Last name (e.g Doe)");
  863. sln = in.next();
  864. System.out.println("\nEnter the Student's ID number (e.g. 29839731982)");
  865. sId = in.nextInt();
  866. System.out.println("\nOn what day will this Student be assigned to the Lab?");
  867. System.out.println("\n 1. Monday & Wednesday"
  868. + "\n2. Tuesday & Thursday"
  869. + "\n3. Monday ONLY"
  870. + "\n4. Tuesday ONLY"
  871. + "\n5. Wednesday ONLY"
  872. + "\n6. Thursday ONLY"
  873. + "\n7. Everyday");
  874. num3 = in.nextInt();
  875. if (num3 < 8)
  876. {//start if
  877. if (num3 <= 4)
  878. {//start if
  879. if (num3 <=2)
  880. {//start if
  881. if (num3 == 1)
  882. {//start if
  883. sd = "Monday & Wednesday";
  884. }//end if
  885. else
  886. {//start else
  887. sd = "Tuesday & Thursday";
  888. }//end else
  889. }//end if
  890. else
  891. {//start else
  892. if (num3 == 3)
  893. {//start if
  894. sd = "Monday";
  895. }//end if
  896. else
  897. {//start else
  898. sd = "Tuesday";
  899. }// end else
  900. }//end else
  901. }//end if
  902. else
  903. {// start else
  904. if (num3 >= 5 && num3 <= 7)
  905. {//start if
  906. if (num3 == 5)
  907. {//start if
  908. sd = "Wednesday";
  909. }// end if
  910. else if (num3 == 6)
  911. {//start else if
  912. sd = "Thursday";
  913. }//end else if
  914. else
  915. {//start else
  916. sd = "Everyday";
  917. }//end else
  918. }//end if
  919. }//end else
  920. }//end if
  921. else
  922. {//error handling
  923. System.err.println("\nERROR!!! Please Enter a number between 1 - 7");
  924. }
  925. System.out.println("\nWhat time will this Student be assigned to the lab?");
  926. System.out.println("\n1. 8:00 AM - 9:15 AM"
  927. + "\n2. 9:25 AM - 10:40 AM"
  928. + "\n3. 10:50 AM - 12:05 AM"
  929. + "\n4. 12:15 AM - 1:30 PM"
  930. + "\n5. 1:40 PM - 2:55 PM"
  931. + "\n6. 3:05 PM - 4:20 PM"
  932. + "\n7. 4:30 PM - 5:45 PM"
  933. + "\n8. 5:55 PM - 7:10 PM"
  934. + "\n9. 7:20 PM - 8:35 PM");
  935. num2 = in.nextInt();
  936. if (num2 < 10)
  937. {//start if
  938. if (num2 <= 5)
  939. {//start if
  940. if (num2 <= 2)
  941. {//start if
  942. if (num2 == 1)
  943. {//start if
  944. st = "8:00 AM - 9:15 AM";
  945. }//end if
  946. else
  947. {//start else
  948. st = "9:25 AM - 10:40 AM";
  949. }//end else
  950. }//end if
  951. if (num2 >= 3 && num2 <= 5)
  952. {//start if
  953. if (num == 3)
  954. {//start if
  955. st = "10:50 AM - 12:05 AM";
  956. }//end if
  957. else if (num == 4)
  958. {//start else if
  959. st = "12:15 AM - 1:30 PM";
  960. }//end else if
  961. else
  962. {//start if
  963. st = "1:40 PM - 2:55 PM";
  964. }//end else
  965. }//end if
  966.  
  967. }//end if
  968. else
  969. {//start else
  970. if (num2 >= 6 && num2 <= 7)
  971. {//start if
  972. if (num == 6)
  973. {// start if
  974. st = "3:05 PM - 4:20 PM";
  975. }// end if
  976. else
  977. {//start else
  978. st = "4:30 PM - 5:45 PM";
  979. }//end else
  980. }//end if
  981. else
  982. {//start else
  983. if (num == 8)
  984. {//start if
  985. st = "5:55 PM - 7:10 PM";
  986. }//end if
  987. else
  988. {//start else
  989. st = "7:20 PM - 8:35 PM";
  990. }//end else
  991. }//end else
  992. }//end else
  993. }//end if
  994. else
  995. {//error handleing
  996.  
  997. System.err.println("\nERROR!!! Please enter a number between 1 - 9....");
  998. }
  999. System.out.println("\nWhich lab is this Student supposed to be assigned to?");
  1000. System.out.println("\n1. NBCL \n2. CSL \n3. CR \n4. HWL \n5. LL");
  1001. num = in.nextInt();
  1002. if (num < 6)
  1003. {
  1004. if (num <=2)
  1005. {
  1006. if (num == 1)
  1007. {
  1008. sl = "NBCL";
  1009. }
  1010. else
  1011. {
  1012. sl = "CSL";
  1013. }
  1014. }
  1015. else
  1016. {
  1017. if (num >=3 && num <= 5)
  1018. {
  1019. if (num == 3)
  1020. {
  1021. sl = "CR";
  1022. }
  1023. else if (num == 4)
  1024. {
  1025. sl= "HWL";
  1026. }
  1027. else
  1028. {
  1029. sl = "LL";
  1030. }
  1031. }
  1032. }
  1033. }
  1034. else
  1035. {
  1036. System.err.println("\nERROR!!! Enter a number from 1 - 5 please...");
  1037. }
  1038. System.out.println("\nEnter the Students Major (e.g. Computer Science)");
  1039. in.nextLine();
  1040. m = in.nextLine();
  1041. if (sl == l || sl == llab)
  1042. {
  1043. if (sd == d || sl == lday)
  1044. {
  1045. if (st == t || sl == lt)
  1046. {
  1047. System.err.println("\nERROR!!!... There is a either a Class at that day and time in that lab, or a Lab Tech is already posted there on that day and time at that lab...");
  1048. }
  1049. else
  1050. {
  1051. System.out.println("\nAre you sure you want to update the entry?");
  1052. System.out.println("\n1. Yes,Update now... \t2. No, Dont update...");
  1053. opt = in.nextInt();
  1054. if (opt == 1)
  1055. {
  1056. System.out.println("\nSucess...");
  1057. ds.updateStudent(data, sfn, sln, sId, sl, sd, st, m);
  1058. }
  1059. else
  1060. {
  1061. System.out.println("\nExiting update....");
  1062. }
  1063. }
  1064.  
  1065. }
  1066. else
  1067. {
  1068. System.out.println("\nAre you sure you want to update the entry?");
  1069. System.out.println("\n1. Yes,Update now... \t2. No, Dont update...");
  1070. opt = in.nextInt();
  1071. if (opt == 1)
  1072. {
  1073. System.out.println("\nSucess...");
  1074. ds.updateStudent(data, sfn, sln, sId, sl, sd, st, m);
  1075. }
  1076. else
  1077. {
  1078. System.out.println("\nExiting update....");
  1079. }
  1080. }
  1081. }
  1082. else
  1083. {
  1084. System.out.println("\nAre you sure you want to update the entry?");
  1085. System.out.println("\n1. Yes,Update now... \t2. No, Dont update...");
  1086. opt = in.nextInt();
  1087. if (opt == 1)
  1088. {
  1089. System.out.println("\nSucess...");
  1090. ds.updateStudent(data, sfn, sln, sId, sl, sd, st, m);
  1091. }
  1092. else
  1093. {
  1094. System.out.println("\nExiting update....");
  1095. }
  1096. }
  1097. }
  1098.  
  1099. else
  1100. {
  1101. System.out.println("\nEnter the Lab Tech's First name (e.g. John)");
  1102. lf = in.next();
  1103. System.out.println("\nEnter the Lab Tech's Last name (e.g. Springer)");
  1104. ll = in.next();
  1105. System.out.println("\nEnter the Lab Tech's Staff ID number (e.g 19732910123)");
  1106. lId = in.nextInt();
  1107. System.out.println("\nOn what day will this Lab Tech be in the Lab?");
  1108. System.out.println("\n 1. Monday & Wednesday"
  1109. + "\n2. Tuesday & Thursday"
  1110. + "\n3. Monday ONLY"
  1111. + "\n4. Tuesday ONLY"
  1112. + "\n5. Wednesday ONLY"
  1113. + "\n6. Thursday ONLY"
  1114. + "\n7. Everyday");
  1115. num3 = in.nextInt();
  1116. if (num3 < 8)
  1117. {
  1118. if (num3 <= 4)
  1119. {
  1120. if (num3 <=2)
  1121. {
  1122. if (num3 == 1)
  1123. {
  1124. lday = "Monday & Wednesday";
  1125. }
  1126. else
  1127. lday = "Tuesday & Thursday";
  1128. }
  1129. else
  1130. {
  1131. if (num3 == 3)
  1132. {
  1133. lday = "Monday";
  1134. }
  1135. else
  1136. {
  1137. lday = "Tuesday";
  1138. }
  1139. }
  1140. }
  1141. else
  1142. {
  1143. if (num3 >= 5 && num3 <= 7)
  1144. {
  1145. if (num3 == 5)
  1146. {
  1147. lday = "Wednesday";
  1148. }
  1149. else if (num3 == 6)
  1150. {
  1151. lday = "Thursday";
  1152. }
  1153. else
  1154. {
  1155. lday = "Everyday";
  1156. }
  1157. }
  1158. }
  1159. }
  1160. else
  1161. {
  1162. System.err.println("\nERROR!!! Please Enter a number between 1 - 7");
  1163. }
  1164. System.out.println("\nAt what time will this Lab Tech be in the Lab?");
  1165. System.out.println("\n1. 8:00 AM - 9:15 AM"
  1166. + "\n2. 9:25 AM - 10:40 AM"
  1167. + "\n3. 10:50 AM - 12:05 AM"
  1168. + "\n4. 12:15 AM - 1:30 PM"
  1169. + "\n5. 1:40 PM - 2:55 PM"
  1170. + "\n6. 3:05 PM - 4:20 PM"
  1171. + "\n7. 4:30 PM - 5:45 PM"
  1172. + "\n8. 5:55 PM - 7:10 PM"
  1173. + "\n9. 7:20 PM - 8:35 PM");
  1174. num2 = in.nextInt();
  1175. if (num2 < 10)
  1176. {
  1177. if (num2 <= 5)
  1178. {
  1179. if (num2 <= 2)
  1180. {
  1181. if (num2 == 1)
  1182. {
  1183. lt = "8:00 AM - 9:15 AM";
  1184. }
  1185. else
  1186. {
  1187. lt = "9:25 AM - 10:40 AM";
  1188. }
  1189. }
  1190. if (num2 >= 3 && num2 <= 5)
  1191. {
  1192. if (num == 3)
  1193. {
  1194. lt = "10:50 AM - 12:05 AM";
  1195. }
  1196. if (num == 4)
  1197. {
  1198. lt = "12:15 AM - 1:30 PM";
  1199. }
  1200. else if (num == 5)
  1201. {
  1202. lt = "1:40 PM - 2:55 PM";
  1203. }
  1204. }
  1205.  
  1206. }
  1207. else
  1208. {
  1209. if (num2 >= 6 && num2 <= 7)
  1210. {
  1211. if (num == 6)
  1212. {
  1213. lt = "3:05 PM - 4:20 PM";
  1214. }
  1215. else
  1216. {
  1217. lt = "4:30 PM - 5:45 PM";
  1218. }
  1219. }
  1220. else
  1221. {
  1222. if (num == 8)
  1223. {
  1224. lt = "5:55 PM - 7:10 PM";
  1225. }
  1226. else
  1227. {
  1228. lt = "7:20 PM - 8:35 PM";
  1229. }
  1230. }
  1231. }
  1232. }
  1233. else
  1234. {
  1235. System.err.println("\nERROR!!! Please enter a number between 1 - 9....");
  1236. }
  1237. System.out.println("\nWhich lab is this Student supposed to be assigned to?");
  1238. System.out.println("\n1. NBCL \n2. CSL \n3. CR \n4. HWL \n5. LL");
  1239. num = in.nextInt();
  1240. if (num < 6)
  1241. {
  1242. if (num <=2)
  1243. {
  1244. if (num == 1)
  1245. {
  1246. llab = "NBCL";
  1247. }
  1248. else
  1249. {
  1250. llab = "CSL";
  1251. }
  1252. }
  1253. else
  1254. {
  1255. if (num >=3 && num <= 5)
  1256. {
  1257. if (num == 3)
  1258. {
  1259. llab = "CR";
  1260. }
  1261. else if (num == 4)
  1262. {
  1263. llab = "HWL";
  1264. }
  1265. else
  1266. {
  1267. llab = "LL";
  1268. }
  1269. }
  1270. }
  1271. }
  1272. else
  1273. {
  1274. System.err.println("\nERROR!!! Enter a number from 1 - 5 please...");
  1275. }
  1276. System.out.println("\nEnter the Lab Tech's Highest Qualifications (e.g. Degree in Computer Science)");
  1277. in.nextLine();
  1278. lq = in.nextLine();
  1279.  
  1280. if (llab == l)
  1281. {
  1282. if (lday == d)
  1283. {
  1284. if (lt == t)
  1285. {
  1286. System.err.println("\nError!!! There is a class at that day and time in that lab...");
  1287. }
  1288. else
  1289. {
  1290. System.out.println("\nAre you sure you want to update the entry?");
  1291. System.out.println("\n1. Yes,Update now... \t2. No, Dont update...");
  1292. opt = in.nextInt();
  1293. if (opt == 1)
  1294. {
  1295. System.out.println("\nSucess...");
  1296. ds.updateLab(data, lf, ll, lId, llab, lday, lt, lq);
  1297. }
  1298. else
  1299. {
  1300. System.out.println("\nExiting update....");
  1301. }
  1302. }
  1303. }
  1304. else
  1305. {
  1306. System.out.println("\nAre you sure you want to update the entry?");
  1307. System.out.println("\n1. Yes,Update now... \t2. No, Dont update...");
  1308. opt = in.nextInt();
  1309. if (opt == 1)
  1310. {
  1311. System.out.println("\nSucess...");
  1312. ds.updateLab(data, lf, ll, lId, llab, lday, lt, lq);
  1313. }
  1314. else
  1315. {
  1316. System.out.println("\nExiting update....");
  1317. }
  1318. }
  1319. }
  1320. else
  1321. {
  1322. System.out.println("\nAre you sure you want to update the entry?");
  1323. System.out.println("\n1. Yes,Update ,now... \t2. No, Dont update...");
  1324. opt = in.nextInt();
  1325. if (opt == 1)
  1326. {
  1327. System.out.println("\nSucess...");
  1328. ds.updateLab(data, lf, ll, lId, llab, lday, lt, lq);
  1329. }
  1330. else
  1331. {
  1332. System.out.println("\nExiting update....");
  1333. }
  1334. }
  1335. }
  1336. }
  1337. }
  1338. }
  1339. break;
  1340. case 5:
  1341. System.out.println("\nYou have selected to View all Entrys...");
  1342. ds.print();
  1343. break;
  1344. case 6:
  1345. System.out.println("\nYou have selected to Search for an entry...");
  1346. System.out.println("\nWhat Tpye of List You would Like to search for?");
  1347. System.out.println("\n1. Class List \n2. Student Worker List \nLab Tech List");
  1348. num = in.nextInt();
  1349. if (num < 3)
  1350. {
  1351. if (num == 1)
  1352. {
  1353. if (ds.isClassEmpty())
  1354. {
  1355. System.err.println("\nThis list is empty");
  1356. }
  1357. else
  1358. {
  1359. System.out.println("\nEnter The Class Code You would like to display...");
  1360. Data = in.next();
  1361. ds.searchClassList(Data);
  1362. }
  1363.  
  1364. }
  1365. else
  1366. {
  1367. if (num == 2)
  1368. {
  1369. if (ds.isStuEmpty())
  1370. {
  1371. System.err.println("\nThis list is empty");
  1372. }
  1373. else
  1374. {
  1375. System.out.println("\nEnter The Student ID you would like to display...");
  1376. data = in.nextInt();
  1377. ds.searchStudentList(data);
  1378. }
  1379. }
  1380. else
  1381. {
  1382. if (ds.isTechEmpty())
  1383. {
  1384. System.err.println("\nThis list is empty");
  1385. }
  1386. else
  1387. {
  1388. System.out.println("\nEnter The Lab Tech ID you would like to display...");
  1389. data = in.nextInt();
  1390. ds.searchTechList(data);
  1391. }
  1392. }
  1393. }
  1394. }
  1395. else
  1396. {
  1397. System.err.println("\nERROR!!!!!!!PLEASE ENTER A NUMBER BETWEEN 1, 2, & 3...");
  1398. }
  1399. break;
  1400. case 7:
  1401. System.out.println("\nYou have selected to View CR Lab schedules...");
  1402. ds.labSchedules();
  1403. break;
  1404. case 8:
  1405. System.out.println("\nYou have selected Help..");
  1406. System.out.println("\n====================================");
  1407. System.out.println("\n===============Guide================");
  1408. System.out.println("\n====================================");
  1409. System.out.println("\n1.Help me!!!");
  1410. System.out.println("\n====================================");
  1411. System.out.println("\n2. Exit help");
  1412. System.out.println("\n=====================================");
  1413. System.out.println("\nWounld you like help?: ");
  1414. opt = in.nextInt();
  1415.  
  1416. if (opt < 2)
  1417. {
  1418. if (opt == 1)
  1419. {
  1420. System.out.println("\nIn what area would you like help?");
  1421. System.out.println("\n1. Insertion... \n2. Deletion... \n3.Updating... \n4. Searching...");
  1422. num = in.nextInt();
  1423. if (num <5)
  1424. {
  1425. if (num == 1)
  1426. {
  1427. System.out.println("\nWhen Inserting data, there are 6 - 7 fields that need to be filled.");
  1428. System.out.println("\nThese feilds are:\n---Classes--- \n\t1. Class Code \n\t2. Class Name \n\t3. Class Letcurer \n\t4.Class Time \n\t5. Class Days \n\t6. Class Location");
  1429. System.out.println("\n---Student--- \n\t1. Student's FirstName \n\t2. Student's LastName \n\t3. Lab Time \n\t4. Lab Day \n\t5. Student ID \n\t6. Lab Location \n\t7. Student Major");
  1430. System.out.println("\n---Lab tech--- \n\t1. Lab Tech's FirstName \n\t2. Tab Tech's LastName \n\t3. Lab Time \n\t4. Lab Day \n\t5. Staff ID \n\t6. Lab Location \n\t7. Lab Tech's Qualification");
  1431. System.out.println("\nAll of these fields require you to enter either a word e.g. (CPTR251), or a phrase. e.g (Computer Science) Some errors that will occur in the insertion field are: "
  1432. + "\n1. When entering data you MUST select one of the numbers given e.g. 1-9..."
  1433. + "\n2. When asked to select a number you MUST enter ONE number..."
  1434. + "\n3. You cannot enter any Special Characters e.g. @,!,#,$,-,^,&,*,(,),?..."
  1435. + "\n4. All data will be entered in the order you give it..."
  1436. + "\n5. When entering Student Worker Info, A student worker CANNOT be in the lab while a Lab technicain is in the lab OR when a CLass is in progress in that lab..."
  1437. + "\n6. When entering Lab Technician Info, a Lab technician CANNOT be in the Lab while a class is in session in the secletive time...");
  1438. }
  1439. else if (num == 2)
  1440. {
  1441. System.out.println("\nWhen deleting a entry the pay attention to the following:");
  1442. System.out.println("\n1. You must enter either the ID number of the Staff, or student, or the CLass Code that you want to delete"
  1443. + "\n\t~If you entered the data correctly then it will appear and be deleted..."
  1444. + "\n2.If the ID numbers or the Class code you entered is not in the list you will recieve a message saying that It isnt found in the list...");
  1445. }
  1446. else if (num == 3)
  1447. {
  1448. System.out.println("\n When Updateing an Entry you must consider the following: "
  1449. + "\n1. When entering data you MUST select one of the numbers given e.g. 1-9..."
  1450. + "\n2. When asked to select a number you MUST enter ONE number..."
  1451. + "\n3. You cannot enter any Special Characters e.g. @,!,#,$,-,^,&,*,(,),?..."
  1452. + "\n4. All data will be entered in the order you give it..."
  1453. + "\n5. When entering Student Worker Info, A student worker CANNOT be in the lab while a Lab technicain is in the lab OR when a CLass is in progress in that lab..."
  1454. + "\n6. When entering Lab Technician Info, a Lab technician CANNOT be in the Lab while a class is in session in the secletive time... "
  1455. + "\n7. When Entering the ID, or Class code of the Entry you want to delete...the program will check to see if it exist AFTER you enter data, So be sure you are entering the correct info before continueing..."
  1456. + "\n8. How this program is designed after you update an Entry you Cannot undo the change unless you go back to update and redo the entire process...");
  1457. }
  1458. else
  1459. {
  1460. System.out.println("\nWhen Searching for data you must consider the following: "
  1461. + "\n1. You must enter either the ID number of the Staff, or student, or the CLass Code that you want to delete"
  1462. + "\n\t~If you entered the data correctly then it will appear and be deleted..."
  1463. + "\n2.If the ID numbers or the Class code you entered is not in the list you will recieve a message saying that It isnt found in the list...");
  1464. }
  1465.  
  1466.  
  1467. }
  1468. }
  1469. else
  1470. {
  1471. System.out.println("\nleaving help.......");
  1472. }
  1473. }
  1474. else
  1475. {
  1476. System.out.println("\nERROR!!!\nENTER EITHER 1 OR 2");
  1477. }
  1478. break;
  1479. case 9:
  1480. System.out.println("\nYou have selected to Exit Program...");
  1481. System.out.println("\nSorry to see you go \t :(");
  1482. System.exit(0);
  1483. break;
  1484. default:
  1485. System.err.println("\nERROR!!!! YOU MUST SELECT A NUMBER FROM THE LIST (1-9)");
  1486. break;
  1487. }
  1488. }
  1489. while (choice <10);
  1490. in.close();
  1491. out.close();
  1492. }
  1493. catch (FileNotFoundException e)
  1494. {
  1495. System.err.println("file not found...");
  1496. }
  1497.  
  1498. }
  1499. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement