Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package app;
- import java.util.*;
- import java.io.*;
- public class Main
- {
- public static void main(String[] args)throws FileNotFoundException
- {
- try
- {
- dataStruct ds = new dataStruct();
- PrintWriter out = new PrintWriter("Final_project.dat");
- Scanner in = new Scanner(System.in);
- String n, sfn, sln, m, c, lect, lf, ll, lq;
- int sId, lId , opt;
- String sl = " ";
- String st = " ";
- String sd = " ";
- String d = " ";
- String l = " ";
- String t = " ";
- String llab = " ";
- String lt = " ";
- String lday = " ";
- int choice = 0;
- int num = 0;
- int num2 = 0;
- int num3 = 0;
- int data = 0;
- String Data = " ";
- do
- {
- System.out.println("\n------WELCOME-----=");
- System.out.println("\n1. ADD A NEW CLASS ENTRY");
- System.out.println("\n-------------------");
- System.out.println("\n2. ADD A NEW EMPLOYEE");
- System.out.println("\n-------------------");
- System.out.println("\n3. DELETE AN ENRTY");
- System.out.println("\n-------------------");
- System.out.println("\n4. UPDATE AN ENTRY");
- System.out.println("\n-------------------");
- System.out.println("\n5. VIEW ALL ENTRYS");
- System.out.println("\n-------------------");
- System.out.println("\n6. SEARCH AN ENTRY");
- System.out.println("\n-------------------");
- System.out.println("\n7. VIEW LAB SCHEDULES FOR CR");
- System.out.println("\n-------------------");
- System.out.println("\n8. HELP GUIDE");
- System.out.println("\n-------------------");
- System.out.println("\n9. EXIT");
- System.out.println("\n-------------------");
- choice = in.nextInt();
- switch (choice)
- {//start switch case
- case 1:
- System.out.println("\nYOU HAVE SELECTED TO ADD A CLASS...");
- do
- {//start do - while loop
- System.out.println("\nEnter The Class Code (e.g CPTR250)");
- c = in.next();
- System.out.println("\nEnter Ther Class Name ");
- in.nextLine();
- n = in.nextLine();
- System.out.println("\nOn what day is the Class Held?");
- System.out.println("\n 1. Monday & Wednesday"
- + "\n2. Tuesday & Thursday");
- num3 = in.nextInt();
- if (num < 3)
- {//start if loop
- if (num3 <=2)
- {//start if loop
- if (num3 == 1)
- {//start if loop
- d = "Monday & Wednesday";
- }//end if loop
- else
- {//start else
- d = "Tuesday & Thursday";
- }//end else
- }//end if
- }//end if
- else
- {//start else
- System.err.println("\nERROR!!! Please Enter a number between 1 - 7");
- }//end else
- System.out.println("\nAt what time is this Class supposed to commence?");
- System.out.println("\n1. 8:00 AM - 9:15 AM"
- + "\n2. 9:25 AM - 10:40 AM"
- + "\n3. 10:50 AM - 12:05 AM"
- + "\n4. 12:15 AM - 1:30 PM"
- + "\n5. 1:40 PM - 2:55 PM"
- + "\n6. 3:05 PM - 4:20 PM"
- + "\n7. 4:30 PM - 5:45 PM"
- + "\n8. 5:55 PM - 7:10 PM"
- + "\n9. 7:20 PM - 8:35 PM");
- num2 = in.nextInt();
- if (num2 < 10)
- {//start if
- if (num2 <= 5)
- {//starts if num is less than or equal to five
- if (num2 <= 2)
- {//starts if num is less than or equal to two
- if (num2 == 1)
- {//starts if
- t = "8:00 AM - 9:15 AM";
- }//ends if
- else
- {//starts else
- t = "9:25 AM - 10:40 AM";
- }//ends else
- }
- if (num2 >= 3 && num2 <= 5)
- {//starts if num is more than or equal to three and less than or equal to five
- if (num == 3)
- {//starts if
- t = "10:50 AM - 12:05 AM";
- }//ends if
- else if (num == 4)
- {//starts else if
- t = "12:15 AM - 1:30 PM";
- }//ends else if
- else
- {//starts else
- t = "1:40 PM - 2:55 PM";
- }//ends else
- }//ends if
- }//ends if
- else
- {//starts else
- if (num2 >= 6 && num2 <= 7)
- {//starts if num is more than or equal to five and less than or equal to seven
- if (num == 6)
- {//starts if
- t = "3:05 PM - 4:20 PM";
- }//ends if
- else
- {//starts else
- t = "4:30 PM - 5:45 PM";
- }//ends else
- }//ends else
- else
- {
- if (num == 8)
- {//start if
- t = "5:55 PM - 7:10 PM";
- }//end if
- else
- {//start else
- t = "7:20 PM - 8:35 PM";
- }//end else
- }
- }//end else
- }//end if
- else
- {//start else...error handling
- System.err.println("\nERROR!!! Please enter a number between 1 - 9....");
- }//end else
- System.out.println("\nEnter The CLass Lecturer (e.g. Mr. Pooneassieh");
- in.nextLine();
- lect = in.nextLine();
- System.out.println("\nWhich lab is this class supposed to be held in?");
- System.out.println("\n1. NBCL \n2. CSL \n3. CR");
- num = in.nextInt();
- if (num < 4)
- {//start if
- if (num == 1)
- {//start if
- l = "NBCL";
- }//end if
- else
- {//start else
- if (num == 2)
- {//start if
- l = "CSL";
- }//end if
- else
- {//start else
- l = "CR";
- }//end else
- }//end else
- }//end if
- else
- {//error handling
- System.err.println("\nERROR!!! Enter a number from 1 - 3 please...");
- }
- ds.addClass(n, c, lect, d, t, l);
- 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");
- opt = in.nextInt();
- if (opt == 2)
- {//start if
- System.out.println("\nReturning to Main.....");
- }//end if
- else if (opt == 1)
- {//start else if
- System.err.println("\nAdding another class...");
- }//end else if
- else
- {// error handling
- System.err.println("ERRORR...enter a number between 1 & 2....");
- }
- }//end do
- while (opt < 2);
- break;
- case 2:
- System.out.println("\nYOU HAVE SELECETED TO ADD A NEW EMPLOYEE...");
- do
- {//start do - while
- System.out.println("\n\tWhat type of employee would you like to add...");
- System.out.println("\n\t\t1. Student Worker");
- System.out.println("\n\t\t2. Lab Technician");
- num = in.nextInt();
- if (num < 3)
- {// start if
- if (num == 1)
- {//start if
- System.out.println("\nEnter the Student's First name (e.g Jerry)");
- sfn = in.next();
- System.out.println("\nEnter the Student's Last name (e.g Doe)");
- sln = in.next();
- System.out.println("\nEnter the Student's ID number (e.g. 29839731982)");
- sId = in.nextInt();
- System.out.println("\nOn what day will this Student be assigned to the Lab?");
- System.out.println("\n 1. Monday & Wednesday"
- + "\n2. Tuesday & Thursday"
- + "\n3. Monday ONLY"
- + "\n4. Tuesday ONLY"
- + "\n5. Wednesday ONLY"
- + "\n6. Thursday ONLY"
- + "\n7. Everyday");
- num3 = in.nextInt();
- if (num3 < 8)
- {//start if
- if (num3 <= 4)
- {//start if
- if (num3 <=2)
- {//start if
- if (num3 == 1)
- {//start if
- sd = "Monday & Wednesday";
- }//end if
- else
- {//start else
- sd = "Tuesday & Thursday";
- }//end else
- }//end if
- else
- {//start else
- if (num3 == 3)
- {//start if
- sd = "Monday";
- }//end if
- else
- {//start else
- sd = "Tuesday";
- }// end else
- }//end else
- }//end if
- else
- {// start else
- if (num3 >= 5 && num3 <= 7)
- {//start if
- if (num3 == 5)
- {//start if
- sd = "Wednesday";
- }// end if
- else if (num3 == 6)
- {//start else if
- sd = "Thursday";
- }//end else if
- else
- {//start else
- sd = "Everyday";
- }//end else
- }//end if
- }//end else
- }//end if
- else
- {//error handling
- System.err.println("\nERROR!!! Please Enter a number between 1 - 7");
- }
- System.out.println("\nWhat time will this Student be assigned to the lab?");
- System.out.println("\n1. 8:00 AM - 9:15 AM"
- + "\n2. 9:25 AM - 10:40 AM"
- + "\n3. 10:50 AM - 12:05 AM"
- + "\n4. 12:15 AM - 1:30 PM"
- + "\n5. 1:40 PM - 2:55 PM"
- + "\n6. 3:05 PM - 4:20 PM"
- + "\n7. 4:30 PM - 5:45 PM"
- + "\n8. 5:55 PM - 7:10 PM"
- + "\n9. 7:20 PM - 8:35 PM");
- num2 = in.nextInt();
- if (num2 < 10)
- {//start if
- if (num2 <= 5)
- {//start if
- if (num2 <= 2)
- {//start if
- if (num2 == 1)
- {//start if
- st = "8:00 AM - 9:15 AM";
- }//end if
- else
- {//start else
- st = "9:25 AM - 10:40 AM";
- }//end else
- }//end if
- if (num2 >= 3 && num2 <= 5)
- {//start if
- if (num == 3)
- {//start if
- st = "10:50 AM - 12:05 AM";
- }//end if
- else if (num == 4)
- {//start else if
- st = "12:15 AM - 1:30 PM";
- }//end else if
- else
- {//start if
- st = "1:40 PM - 2:55 PM";
- }//end else
- }//end if
- }//end if
- else
- {//start else
- if (num2 >= 6 && num2 <= 7)
- {//start if
- if (num == 6)
- {// start if
- st = "3:05 PM - 4:20 PM";
- }// end if
- else
- {//start else
- st = "4:30 PM - 5:45 PM";
- }//end else
- }//end if
- else
- {//start else
- if (num == 8)
- {//start if
- st = "5:55 PM - 7:10 PM";
- }//end if
- else
- {//start else
- st = "7:20 PM - 8:35 PM";
- }//end else
- }//end else
- }//end else
- }//end if
- else
- {//error handleing
- System.err.println("\nERROR!!! Please enter a number between 1 - 9....");
- }
- System.out.println("\nWhich lab is this Student supposed to be assigned to?");
- System.out.println("\n1. NBCL \n2. CSL \n3. CR \n4. HWL \n5. LL");
- num = in.nextInt();
- if (num < 6)
- {
- if (num <=2)
- {
- if (num == 1)
- {
- sl = "NBCL";
- }
- else
- {
- sl = "CSL";
- }
- }
- else
- {
- if (num >=3 && num <= 5)
- {
- if (num == 3)
- {
- sl = "CR";
- }
- else if (num == 4)
- {
- sl= "HWL";
- }
- else
- {
- sl = "LL";
- }
- }
- }
- }
- else
- {
- System.err.println("\nERROR!!! Enter a number from 1 - 5 please...");
- }
- System.out.println("\nEnter the Students Major (e.g. Computer Science)");
- in.nextLine();
- m = in.nextLine();
- if (sl == l || sl == llab)
- {
- if (sd == d || sl == lday)
- {
- if (st == t || sl == lt)
- {
- 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...");
- }
- else
- System.out.println("\nSucess...");
- ds.addStudent(sfn, sln, sId, sl, sd, st, m);
- }
- else
- {
- System.out.println("\nSucess....");
- ds.addStudent(sfn, sln, sId, sl, sd, st, m);
- }
- }
- else
- {
- System.out.println("\nSucess...");
- ds.addStudent(sfn, sln, sId, sl, sd, st, m);
- }
- }
- else
- {
- System.out.println("\nEnter the Lab Tech's First name (e.g. John)");
- lf = in.next();
- System.out.println("\nEnter the Lab Tech's Last name (e.g. Springer)");
- ll = in.next();
- System.out.println("\nEnter the Lab Tech's Staff ID number (e.g 19732910123)");
- lId = in.nextInt();
- System.out.println("\nOn what day will this Lab Tech be in the Lab?");
- System.out.println("\n 1. Monday & Wednesday"
- + "\n2. Tuesday & Thursday"
- + "\n3. Monday ONLY"
- + "\n4. Tuesday ONLY"
- + "\n5. Wednesday ONLY"
- + "\n6. Thursday ONLY"
- + "\n7. Everyday");
- num3 = in.nextInt();
- if (num3 < 8)
- {
- if (num3 <= 4)
- {
- if (num3 <=2)
- {
- if (num3 == 1)
- {
- lday = "Monday & Wednesday";
- }
- else
- lday = "Tuesday & Thursday";
- }
- else
- {
- if (num3 == 3)
- {
- lday = "Monday";
- }
- else
- {
- lday = "Tuesday";
- }
- }
- }
- else
- {
- if (num3 >= 5 && num3 <= 7)
- {
- if (num3 == 5)
- {
- lday = "Wednesday";
- }
- else if (num3 == 6)
- {
- lday = "Thursday";
- }
- else
- {
- lday = "Everyday";
- }
- }
- }
- }
- else
- {
- System.err.println("\nERROR!!! Please Enter a number between 1 - 7");
- }
- System.out.println("\nAt what time will this Lab Tech be in the Lab?");
- System.out.println("\n1. 8:00 AM - 9:15 AM"
- + "\n2. 9:25 AM - 10:40 AM"
- + "\n3. 10:50 AM - 12:05 AM"
- + "\n4. 12:15 AM - 1:30 PM"
- + "\n5. 1:40 PM - 2:55 PM"
- + "\n6. 3:05 PM - 4:20 PM"
- + "\n7. 4:30 PM - 5:45 PM"
- + "\n8. 5:55 PM - 7:10 PM"
- + "\n9. 7:20 PM - 8:35 PM");
- num2 = in.nextInt();
- if (num2 < 10)
- {
- if (num2 <= 5)
- {
- if (num2 <= 2)
- {
- if (num2 == 1)
- {
- lt = "8:00 AM - 9:15 AM";
- }
- else
- {
- lt = "9:25 AM - 10:40 AM";
- }
- }
- if (num2 >= 3 && num2 <= 5)
- {
- if (num == 3)
- {
- lt = "10:50 AM - 12:05 AM";
- }
- if (num == 4)
- {
- lt = "12:15 AM - 1:30 PM";
- }
- else if (num == 5)
- {
- lt = "1:40 PM - 2:55 PM";
- }
- }
- }
- else
- {
- if (num2 >= 6 && num2 <= 7)
- {
- if (num == 6)
- {
- lt = "3:05 PM - 4:20 PM";
- }
- else
- {
- lt = "4:30 PM - 5:45 PM";
- }
- }
- else
- {
- if (num == 8)
- {
- lt = "5:55 PM - 7:10 PM";
- }
- else
- {
- lt = "7:20 PM - 8:35 PM";
- }
- }
- }
- }
- else
- {
- System.err.println("\nERROR!!! Please enter a number between 1 - 9....");
- }
- System.out.println("\nWhich lab is this Student supposed to be assigned to?");
- System.out.println("\n1. NBCL \n2. CSL \n3. CR \n4. HWL \n5. LL");
- num = in.nextInt();
- if (num < 6)
- {
- if (num <=2)
- {
- if (num == 1)
- {
- llab = "NBCL";
- }
- else
- {
- llab = "CSL";
- }
- }
- else
- {
- if (num >=3 && num <= 5)
- {
- if (num == 3)
- {
- llab = "CR";
- }
- else if (num == 4)
- {
- llab = "HWL";
- }
- else
- {
- llab = "LL";
- }
- }
- }
- }
- else
- {
- System.err.println("\nERROR!!! Enter a number from 1 - 5 please...");
- }
- System.out.println("\nEnter the Lab Tech's Highest Qualifications (e.g. Degree in Computer Science)");
- in.nextLine();
- lq = in.nextLine();
- if (llab == l)
- {
- if (lday == d)
- {
- if (lt == t)
- {
- System.err.println("\nError!!! There is a class at that day and time in that lab...");
- }
- else
- {
- System.out.println("\nSucess...");
- ds.addLabTech(lf, ll, lId, llab, lday, lt, lq);
- }
- }
- else
- {
- System.out.println("\nSucess...");
- ds.addLabTech(lf, ll, lId, llab, lday, lt, lq);
- }
- }
- else
- {
- System.out.println("\nSucess...");
- ds.addLabTech(lf, ll, lId, llab, lday, lt, lq);
- }
- }
- }
- else
- {
- System.err.println("\nERROR!!!YOU MUST ENTER EITHER 1 OR 2...");
- }
- System.out.println("\nWould You Like to Add another Employee? \n1.Yes I would... \n2.No...I want to return to the menu");
- num = in.nextInt();
- }
- while (num <2);
- if (num == 2)
- {
- System.out.println("\nReturning to Main....");
- }
- else
- {
- System.err.println("\nAdding another employee...");
- }
- break;
- case 3:
- System.out.println("\nYou have selected to Delete an entry...");
- while (num < 2)
- {
- if (num <3)
- {
- System.out.println("\nWhat type of entry would you like to delete? \n\n1. Class\n2. Student Worker\n3. Lab Technician");
- num = in.nextInt();
- if (num == 1)
- {
- System.out.println("\nEnter the Course Code of the Class you would like to delete...");
- Data = in.next();
- ds.deleteCLass(Data);
- }
- else
- {
- if (num == 2)
- {
- System.out.println("\nEnter the ID number of the Student Worker you would like to delete...");
- data = in.nextInt();
- ds.deleteStudent(data);
- }
- else
- {
- System.out.println("\nEnter the Staff ID number of the Lab Technician you would like to delete...");
- data = in.nextInt();
- ds.deleteLab(data);
- }
- }
- }
- else
- {
- System.err.println("\nERRORR!!!!!!\nINVALID NUMBER...\nENTER A NUMBER AMONG THE FOLLOWING \t 1,2, OR 3");
- }
- System.out.println("\nWould You Like to delete another Employee? \n1.Yes I would... \n2.No...I want to return to the menu");
- }
- break;
- case 4:
- System.out.println("\nYou have selected to Update an Entry...");
- System.out.println("\nWhat type of Entry would you like to Update?");
- System.out.println("\n1. Class \n2. Student Worker \n3. Lab Tech");
- opt = in.nextInt();
- if (opt <= 3)
- {
- if (opt == 1)
- {
- System.out.println("\nEnter The Class Code (e.g CPTR250)");
- c = in.next();
- System.out.println("\nEnter Ther Class Name ");
- in.nextLine();
- n = in.nextLine();
- System.out.println("\nOn what day is the Class Held?");
- System.out.println("\n 1. Monday & Wednesday"
- + "\n2. Tuesday & Thursday");
- num3 = in.nextInt();
- if (num < 3)
- {//start if loop
- if (num3 <=2)
- {//start if loop
- if (num3 == 1)
- {//start if loop
- d = "Monday & Wednesday";
- }//end if loop
- else
- {//start else
- d = "Tuesday & Thursday";
- }//end else
- }//end if
- }//end if
- else
- {//start else
- System.err.println("\nERROR!!! Please Enter a number between 1 - 7");
- }//end else
- System.out.println("\nAt what time is this Class supposed to commence?");
- System.out.println("\n1. 8:00 AM - 9:15 AM"
- + "\n2. 9:25 AM - 10:40 AM"
- + "\n3. 10:50 AM - 12:05 AM"
- + "\n4. 12:15 AM - 1:30 PM"
- + "\n5. 1:40 PM - 2:55 PM"
- + "\n6. 3:05 PM - 4:20 PM"
- + "\n7. 4:30 PM - 5:45 PM"
- + "\n8. 5:55 PM - 7:10 PM"
- + "\n9. 7:20 PM - 8:35 PM");
- num2 = in.nextInt();
- if (num2 < 10)
- {//start if
- if (num2 <= 5)
- {//starts if num is less than or equal to five
- if (num2 <= 2)
- {//starts if num is less than or equal to two
- if (num2 == 1)
- {//starts if
- t = "8:00 AM - 9:15 AM";
- }//ends if
- else
- {//starts else
- t = "9:25 AM - 10:40 AM";
- }//ends else
- }
- if (num2 >= 3 && num2 <= 5)
- {//starts if num is more than or equal to three and less than or equal to five
- if (num == 3)
- {//starts if
- t = "10:50 AM - 12:05 AM";
- }//ends if
- else if (num == 4)
- {//starts else if
- t = "12:15 AM - 1:30 PM";
- }//ends else if
- else
- {//starts else
- t = "1:40 PM - 2:55 PM";
- }//ends else
- }//ends if
- }//ends if
- else
- {//starts else
- if (num2 >= 6 && num2 <= 7)
- {//starts if num is more than or equal to five and less than or equal to seven
- if (num == 6)
- {//starts if
- t = "3:05 PM - 4:20 PM";
- }//ends if
- else
- {//starts else
- t = "4:30 PM - 5:45 PM";
- }//ends else
- }//ends else
- else
- {
- if (num == 8)
- {//start if
- t = "5:55 PM - 7:10 PM";
- }//end if
- else
- {//start else
- t = "7:20 PM - 8:35 PM";
- }//end else
- }
- }//end else
- }//end if
- else
- {//start else...error handling
- System.err.println("\nERROR!!! Please enter a number between 1 - 9....");
- }//end else
- System.out.println("\nEnter The CLass Lecturer (e.g. Mr. Pooneassieh");
- in.nextLine();
- lect = in.nextLine();
- System.out.println("\nWhich lab is this class supposed to be held in?");
- System.out.println("\n1. NBCL \n2. CSL \n3. CR");
- num = in.nextInt();
- if (num < 4)
- {//start if
- if (num == 1)
- {//start if
- l = "NBCL";
- }//end if
- else
- {//start else
- if (num == 2)
- {//start if
- l = "CSL";
- }//end if
- else
- {//start else
- l = "CR";
- }//end else
- }//end else
- }//end if
- else
- {//error handling
- System.err.println("\nERROR!!! Enter a number from 1 - 3 please...");
- }
- System.out.println("\nAre you sure you want to update the entry?");
- System.out.println("\n1. Yes,Update now... \t2. No, Dont update...");
- opt = in.nextInt();
- if (opt == 1)
- {
- System.out.println("\nSucess...");
- ds.updateClass(Data, n, c, lect, d, t, l);
- }
- else
- {
- System.out.println("\nExiting update....");
- }
- }
- else if (opt == 2)
- {
- System.out.println("\n\tWhat type of employee would you like to add...");
- System.out.println("\n\t\t1. Student Worker");
- System.out.println("\n\t\t2. Lab Technician");
- num = in.nextInt();
- if (num < 2 && num > 0)
- {// start if
- if (num == 1)
- {//start if
- System.out.println("\nEnter the Student's First name (e.g Jerry)");
- sfn = in.next();
- System.out.println("\nEnter the Student's Last name (e.g Doe)");
- sln = in.next();
- System.out.println("\nEnter the Student's ID number (e.g. 29839731982)");
- sId = in.nextInt();
- System.out.println("\nOn what day will this Student be assigned to the Lab?");
- System.out.println("\n 1. Monday & Wednesday"
- + "\n2. Tuesday & Thursday"
- + "\n3. Monday ONLY"
- + "\n4. Tuesday ONLY"
- + "\n5. Wednesday ONLY"
- + "\n6. Thursday ONLY"
- + "\n7. Everyday");
- num3 = in.nextInt();
- if (num3 < 8)
- {//start if
- if (num3 <= 4)
- {//start if
- if (num3 <=2)
- {//start if
- if (num3 == 1)
- {//start if
- sd = "Monday & Wednesday";
- }//end if
- else
- {//start else
- sd = "Tuesday & Thursday";
- }//end else
- }//end if
- else
- {//start else
- if (num3 == 3)
- {//start if
- sd = "Monday";
- }//end if
- else
- {//start else
- sd = "Tuesday";
- }// end else
- }//end else
- }//end if
- else
- {// start else
- if (num3 >= 5 && num3 <= 7)
- {//start if
- if (num3 == 5)
- {//start if
- sd = "Wednesday";
- }// end if
- else if (num3 == 6)
- {//start else if
- sd = "Thursday";
- }//end else if
- else
- {//start else
- sd = "Everyday";
- }//end else
- }//end if
- }//end else
- }//end if
- else
- {//error handling
- System.err.println("\nERROR!!! Please Enter a number between 1 - 7");
- }
- System.out.println("\nWhat time will this Student be assigned to the lab?");
- System.out.println("\n1. 8:00 AM - 9:15 AM"
- + "\n2. 9:25 AM - 10:40 AM"
- + "\n3. 10:50 AM - 12:05 AM"
- + "\n4. 12:15 AM - 1:30 PM"
- + "\n5. 1:40 PM - 2:55 PM"
- + "\n6. 3:05 PM - 4:20 PM"
- + "\n7. 4:30 PM - 5:45 PM"
- + "\n8. 5:55 PM - 7:10 PM"
- + "\n9. 7:20 PM - 8:35 PM");
- num2 = in.nextInt();
- if (num2 < 10)
- {//start if
- if (num2 <= 5)
- {//start if
- if (num2 <= 2)
- {//start if
- if (num2 == 1)
- {//start if
- st = "8:00 AM - 9:15 AM";
- }//end if
- else
- {//start else
- st = "9:25 AM - 10:40 AM";
- }//end else
- }//end if
- if (num2 >= 3 && num2 <= 5)
- {//start if
- if (num == 3)
- {//start if
- st = "10:50 AM - 12:05 AM";
- }//end if
- else if (num == 4)
- {//start else if
- st = "12:15 AM - 1:30 PM";
- }//end else if
- else
- {//start if
- st = "1:40 PM - 2:55 PM";
- }//end else
- }//end if
- }//end if
- else
- {//start else
- if (num2 >= 6 && num2 <= 7)
- {//start if
- if (num == 6)
- {// start if
- st = "3:05 PM - 4:20 PM";
- }// end if
- else
- {//start else
- st = "4:30 PM - 5:45 PM";
- }//end else
- }//end if
- else
- {//start else
- if (num == 8)
- {//start if
- st = "5:55 PM - 7:10 PM";
- }//end if
- else
- {//start else
- st = "7:20 PM - 8:35 PM";
- }//end else
- }//end else
- }//end else
- }//end if
- else
- {//error handleing
- System.err.println("\nERROR!!! Please enter a number between 1 - 9....");
- }
- System.out.println("\nWhich lab is this Student supposed to be assigned to?");
- System.out.println("\n1. NBCL \n2. CSL \n3. CR \n4. HWL \n5. LL");
- num = in.nextInt();
- if (num < 6)
- {
- if (num <=2)
- {
- if (num == 1)
- {
- sl = "NBCL";
- }
- else
- {
- sl = "CSL";
- }
- }
- else
- {
- if (num >=3 && num <= 5)
- {
- if (num == 3)
- {
- sl = "CR";
- }
- else if (num == 4)
- {
- sl= "HWL";
- }
- else
- {
- sl = "LL";
- }
- }
- }
- }
- else
- {
- System.err.println("\nERROR!!! Enter a number from 1 - 5 please...");
- }
- System.out.println("\nEnter the Students Major (e.g. Computer Science)");
- in.nextLine();
- m = in.nextLine();
- if (sl == l || sl == llab)
- {
- if (sd == d || sl == lday)
- {
- if (st == t || sl == lt)
- {
- 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...");
- }
- else
- {
- System.out.println("\nAre you sure you want to update the entry?");
- System.out.println("\n1. Yes,Update now... \t2. No, Dont update...");
- opt = in.nextInt();
- if (opt == 1)
- {
- System.out.println("\nSucess...");
- ds.updateStudent(data, sfn, sln, sId, sl, sd, st, m);
- }
- else
- {
- System.out.println("\nExiting update....");
- }
- }
- }
- else
- {
- System.out.println("\nAre you sure you want to update the entry?");
- System.out.println("\n1. Yes,Update now... \t2. No, Dont update...");
- opt = in.nextInt();
- if (opt == 1)
- {
- System.out.println("\nSucess...");
- ds.updateStudent(data, sfn, sln, sId, sl, sd, st, m);
- }
- else
- {
- System.out.println("\nExiting update....");
- }
- }
- }
- else
- {
- System.out.println("\nAre you sure you want to update the entry?");
- System.out.println("\n1. Yes,Update now... \t2. No, Dont update...");
- opt = in.nextInt();
- if (opt == 1)
- {
- System.out.println("\nSucess...");
- ds.updateStudent(data, sfn, sln, sId, sl, sd, st, m);
- }
- else
- {
- System.out.println("\nExiting update....");
- }
- }
- }
- else
- {
- System.out.println("\nEnter the Lab Tech's First name (e.g. John)");
- lf = in.next();
- System.out.println("\nEnter the Lab Tech's Last name (e.g. Springer)");
- ll = in.next();
- System.out.println("\nEnter the Lab Tech's Staff ID number (e.g 19732910123)");
- lId = in.nextInt();
- System.out.println("\nOn what day will this Lab Tech be in the Lab?");
- System.out.println("\n 1. Monday & Wednesday"
- + "\n2. Tuesday & Thursday"
- + "\n3. Monday ONLY"
- + "\n4. Tuesday ONLY"
- + "\n5. Wednesday ONLY"
- + "\n6. Thursday ONLY"
- + "\n7. Everyday");
- num3 = in.nextInt();
- if (num3 < 8)
- {
- if (num3 <= 4)
- {
- if (num3 <=2)
- {
- if (num3 == 1)
- {
- lday = "Monday & Wednesday";
- }
- else
- lday = "Tuesday & Thursday";
- }
- else
- {
- if (num3 == 3)
- {
- lday = "Monday";
- }
- else
- {
- lday = "Tuesday";
- }
- }
- }
- else
- {
- if (num3 >= 5 && num3 <= 7)
- {
- if (num3 == 5)
- {
- lday = "Wednesday";
- }
- else if (num3 == 6)
- {
- lday = "Thursday";
- }
- else
- {
- lday = "Everyday";
- }
- }
- }
- }
- else
- {
- System.err.println("\nERROR!!! Please Enter a number between 1 - 7");
- }
- System.out.println("\nAt what time will this Lab Tech be in the Lab?");
- System.out.println("\n1. 8:00 AM - 9:15 AM"
- + "\n2. 9:25 AM - 10:40 AM"
- + "\n3. 10:50 AM - 12:05 AM"
- + "\n4. 12:15 AM - 1:30 PM"
- + "\n5. 1:40 PM - 2:55 PM"
- + "\n6. 3:05 PM - 4:20 PM"
- + "\n7. 4:30 PM - 5:45 PM"
- + "\n8. 5:55 PM - 7:10 PM"
- + "\n9. 7:20 PM - 8:35 PM");
- num2 = in.nextInt();
- if (num2 < 10)
- {
- if (num2 <= 5)
- {
- if (num2 <= 2)
- {
- if (num2 == 1)
- {
- lt = "8:00 AM - 9:15 AM";
- }
- else
- {
- lt = "9:25 AM - 10:40 AM";
- }
- }
- if (num2 >= 3 && num2 <= 5)
- {
- if (num == 3)
- {
- lt = "10:50 AM - 12:05 AM";
- }
- if (num == 4)
- {
- lt = "12:15 AM - 1:30 PM";
- }
- else if (num == 5)
- {
- lt = "1:40 PM - 2:55 PM";
- }
- }
- }
- else
- {
- if (num2 >= 6 && num2 <= 7)
- {
- if (num == 6)
- {
- lt = "3:05 PM - 4:20 PM";
- }
- else
- {
- lt = "4:30 PM - 5:45 PM";
- }
- }
- else
- {
- if (num == 8)
- {
- lt = "5:55 PM - 7:10 PM";
- }
- else
- {
- lt = "7:20 PM - 8:35 PM";
- }
- }
- }
- }
- else
- {
- System.err.println("\nERROR!!! Please enter a number between 1 - 9....");
- }
- System.out.println("\nWhich lab is this Student supposed to be assigned to?");
- System.out.println("\n1. NBCL \n2. CSL \n3. CR \n4. HWL \n5. LL");
- num = in.nextInt();
- if (num < 6)
- {
- if (num <=2)
- {
- if (num == 1)
- {
- llab = "NBCL";
- }
- else
- {
- llab = "CSL";
- }
- }
- else
- {
- if (num >=3 && num <= 5)
- {
- if (num == 3)
- {
- llab = "CR";
- }
- else if (num == 4)
- {
- llab = "HWL";
- }
- else
- {
- llab = "LL";
- }
- }
- }
- }
- else
- {
- System.err.println("\nERROR!!! Enter a number from 1 - 5 please...");
- }
- System.out.println("\nEnter the Lab Tech's Highest Qualifications (e.g. Degree in Computer Science)");
- in.nextLine();
- lq = in.nextLine();
- if (llab == l)
- {
- if (lday == d)
- {
- if (lt == t)
- {
- System.err.println("\nError!!! There is a class at that day and time in that lab...");
- }
- else
- {
- System.out.println("\nAre you sure you want to update the entry?");
- System.out.println("\n1. Yes,Update now... \t2. No, Dont update...");
- opt = in.nextInt();
- if (opt == 1)
- {
- System.out.println("\nSucess...");
- ds.updateLab(data, lf, ll, lId, llab, lday, lt, lq);
- }
- else
- {
- System.out.println("\nExiting update....");
- }
- }
- }
- else
- {
- System.out.println("\nAre you sure you want to update the entry?");
- System.out.println("\n1. Yes,Update now... \t2. No, Dont update...");
- opt = in.nextInt();
- if (opt == 1)
- {
- System.out.println("\nSucess...");
- ds.updateLab(data, lf, ll, lId, llab, lday, lt, lq);
- }
- else
- {
- System.out.println("\nExiting update....");
- }
- }
- }
- else
- {
- System.out.println("\nAre you sure you want to update the entry?");
- System.out.println("\n1. Yes,Update ,now... \t2. No, Dont update...");
- opt = in.nextInt();
- if (opt == 1)
- {
- System.out.println("\nSucess...");
- ds.updateLab(data, lf, ll, lId, llab, lday, lt, lq);
- }
- else
- {
- System.out.println("\nExiting update....");
- }
- }
- }
- }
- }
- }
- break;
- case 5:
- System.out.println("\nYou have selected to View all Entrys...");
- ds.print();
- break;
- case 6:
- System.out.println("\nYou have selected to Search for an entry...");
- System.out.println("\nWhat Tpye of List You would Like to search for?");
- System.out.println("\n1. Class List \n2. Student Worker List \nLab Tech List");
- num = in.nextInt();
- if (num < 3)
- {
- if (num == 1)
- {
- if (ds.isClassEmpty())
- {
- System.err.println("\nThis list is empty");
- }
- else
- {
- System.out.println("\nEnter The Class Code You would like to display...");
- Data = in.next();
- ds.searchClassList(Data);
- }
- }
- else
- {
- if (num == 2)
- {
- if (ds.isStuEmpty())
- {
- System.err.println("\nThis list is empty");
- }
- else
- {
- System.out.println("\nEnter The Student ID you would like to display...");
- data = in.nextInt();
- ds.searchStudentList(data);
- }
- }
- else
- {
- if (ds.isTechEmpty())
- {
- System.err.println("\nThis list is empty");
- }
- else
- {
- System.out.println("\nEnter The Lab Tech ID you would like to display...");
- data = in.nextInt();
- ds.searchTechList(data);
- }
- }
- }
- }
- else
- {
- System.err.println("\nERROR!!!!!!!PLEASE ENTER A NUMBER BETWEEN 1, 2, & 3...");
- }
- break;
- case 7:
- System.out.println("\nYou have selected to View CR Lab schedules...");
- ds.labSchedules();
- break;
- case 8:
- System.out.println("\nYou have selected Help..");
- System.out.println("\n====================================");
- System.out.println("\n===============Guide================");
- System.out.println("\n====================================");
- System.out.println("\n1.Help me!!!");
- System.out.println("\n====================================");
- System.out.println("\n2. Exit help");
- System.out.println("\n=====================================");
- System.out.println("\nWounld you like help?: ");
- opt = in.nextInt();
- if (opt < 2)
- {
- if (opt == 1)
- {
- System.out.println("\nIn what area would you like help?");
- System.out.println("\n1. Insertion... \n2. Deletion... \n3.Updating... \n4. Searching...");
- num = in.nextInt();
- if (num <5)
- {
- if (num == 1)
- {
- System.out.println("\nWhen Inserting data, there are 6 - 7 fields that need to be filled.");
- 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");
- 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");
- 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");
- 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: "
- + "\n1. When entering data you MUST select one of the numbers given e.g. 1-9..."
- + "\n2. When asked to select a number you MUST enter ONE number..."
- + "\n3. You cannot enter any Special Characters e.g. @,!,#,$,-,^,&,*,(,),?..."
- + "\n4. All data will be entered in the order you give it..."
- + "\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..."
- + "\n6. When entering Lab Technician Info, a Lab technician CANNOT be in the Lab while a class is in session in the secletive time...");
- }
- else if (num == 2)
- {
- System.out.println("\nWhen deleting a entry the pay attention to the following:");
- 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"
- + "\n\t~If you entered the data correctly then it will appear and be deleted..."
- + "\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...");
- }
- else if (num == 3)
- {
- System.out.println("\n When Updateing an Entry you must consider the following: "
- + "\n1. When entering data you MUST select one of the numbers given e.g. 1-9..."
- + "\n2. When asked to select a number you MUST enter ONE number..."
- + "\n3. You cannot enter any Special Characters e.g. @,!,#,$,-,^,&,*,(,),?..."
- + "\n4. All data will be entered in the order you give it..."
- + "\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..."
- + "\n6. When entering Lab Technician Info, a Lab technician CANNOT be in the Lab while a class is in session in the secletive time... "
- + "\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..."
- + "\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...");
- }
- else
- {
- System.out.println("\nWhen Searching for data you must consider the following: "
- + "\n1. You must enter either the ID number of the Staff, or student, or the CLass Code that you want to delete"
- + "\n\t~If you entered the data correctly then it will appear and be deleted..."
- + "\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...");
- }
- }
- }
- else
- {
- System.out.println("\nleaving help.......");
- }
- }
- else
- {
- System.out.println("\nERROR!!!\nENTER EITHER 1 OR 2");
- }
- break;
- case 9:
- System.out.println("\nYou have selected to Exit Program...");
- System.out.println("\nSorry to see you go \t :(");
- System.exit(0);
- break;
- default:
- System.err.println("\nERROR!!!! YOU MUST SELECT A NUMBER FROM THE LIST (1-9)");
- break;
- }
- }
- while (choice <10);
- in.close();
- out.close();
- }
- catch (FileNotFoundException e)
- {
- System.err.println("file not found...");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement