|
|
@ -1,6 +1,7 @@ |
|
|
|
package org.example; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Scanner; |
|
|
|
|
|
|
|
public class Main { |
|
|
@ -57,6 +58,32 @@ public class Main { |
|
|
|
break; |
|
|
|
case 5: |
|
|
|
// Drop Student from Course |
|
|
|
System.out.println("Enter Student ID"); |
|
|
|
String studentID = scanner.next(); |
|
|
|
System.out.println("Enter Course ID"); |
|
|
|
String courseIdToDrop = scanner.next(); |
|
|
|
|
|
|
|
Student student = administration.findStudentById(studentID); |
|
|
|
Course course = administration.findCourseByID(courseIdToDrop); |
|
|
|
|
|
|
|
Map<Course, String> studentCourses = student.getCourseGrades(); |
|
|
|
if (student != null && course != null) { |
|
|
|
|
|
|
|
if(studentCourses.containsKey(course)){ |
|
|
|
studentCourses.remove(course); |
|
|
|
student.setCourseGrades(studentCourses); |
|
|
|
System.out.println("Student has been dropped from the choosen course"); |
|
|
|
} |
|
|
|
else{ |
|
|
|
System.out.println("Student was not in this course"); |
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
if (student == null) System.out.println("Student ID not found."); |
|
|
|
if (course == null) System.out.println("Course ID not found."); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
break; |
|
|
|
case 6: |
|
|
|
// Create Course |
|
|
|