Exemplo n.º 1
0
 // --------------------- M E N U ---------------------
 public void process() {
   boolean working = true;
   int input;
   while (working) {
     System.out.println("----------Menu----------");
     System.out.println("(1) student");
     System.out.println("(2) teacher");
     System.out.print("> ");
     input = scan.nextInt();
     if (input == 1) {
       System.out.println("----------Student----------");
       System.out.println("(1) list");
       System.out.println("(2) data");
       System.out.println("(3) add");
       System.out.println("(4) delete");
       System.out.print("> ");
       input = scan.nextInt();
       switch (input) {
         case 1:
           printStudentList();
           break;
         case 2:
           studentData();
           break;
         case 3:
           addStudent();
           break;
         case 4:
           deleteStudent();
           break;
       }
     } else if (input == 2) {
       System.out.println("----------Teacher----------");
       System.out.println("(1) list");
       System.out.println("(2) data");
       System.out.println("(3) add");
       System.out.println("(4) delete");
       System.out.print("> ");
       input = scan.nextInt();
       switch (input) {
         case 1:
           printTeacherList();
           break;
         case 2:
           teacherData();
           break;
         case 3:
           addTeacher();
           break;
         case 4:
           deleteTeacher();
           break;
       }
     }
   }
 }
Exemplo n.º 2
0
 public void deleteTeacher() {
   System.out.println("----------Delete Student----------");
   printTeacherList();
   System.out.println("Input Teacher ID");
   System.out.print("> ");
   int deleteID = scan.nextInt();
   int i = 0;
   for (Teacher teacher : teacher) {
     if (teacher.getTeacherID() == deleteID) {
       this.teacher.remove(this.teacher.get(i));
     }
     i++;
   }
 }