|
|
@ -30,10 +30,7 @@ public class Main { |
|
|
|
System.out.println("8. View Courses"); |
|
|
|
System.out.println("9. Assign Grade to Student"); |
|
|
|
System.out.println("10. View Grades from Student"); |
|
|
|
System.out.println("11. View User"); |
|
|
|
System.out.println("12. Delete User"); |
|
|
|
System.out.println("13. View Course List"); |
|
|
|
System.out.println("14. Exit (includes saving data in the files)"); |
|
|
|
System.out.println("11. Exit (includes saving data in the files)"); |
|
|
|
System.out.print("Select an option: "); |
|
|
|
|
|
|
|
int choice = scanner.nextInt(); |
|
|
@ -84,23 +81,38 @@ public class Main { |
|
|
|
break; |
|
|
|
case 8: |
|
|
|
// View Courses |
|
|
|
administration.viewCourses(); |
|
|
|
break; |
|
|
|
case 9: |
|
|
|
// Assign Grade to Student |
|
|
|
System.out.println("Assign Grade to Student selected"); |
|
|
|
System.out.print("Enter Student ID: "); |
|
|
|
String toBeGradedstudentId = scanner.next(); |
|
|
|
System.out.print("Enter Course ID: "); |
|
|
|
String toBeGradedcourseId = scanner.next(); |
|
|
|
System.out.print("Enter Grade: "); |
|
|
|
String grade = scanner.next(); |
|
|
|
|
|
|
|
boolean success = administration.assignGradeToStudent(toBeGradedstudentId, toBeGradedcourseId, grade); |
|
|
|
if (success) { |
|
|
|
System.out.println("Grade assigned successfully."); |
|
|
|
} else { |
|
|
|
System.out.println("Failed to assign grade. Ensure the student and course IDs are correct."); |
|
|
|
} |
|
|
|
break; |
|
|
|
case 10: |
|
|
|
// View Grades from Student |
|
|
|
System.out.print("Enter Student ID to view grades: "); |
|
|
|
String GradedstudentId = scanner.next(); |
|
|
|
Student student = administration.findStudentById(GradedstudentId); |
|
|
|
if (student != null) { |
|
|
|
student.printGrades(); |
|
|
|
} else { |
|
|
|
System.out.println("Student not found."); |
|
|
|
} |
|
|
|
break; |
|
|
|
|
|
|
|
case 11: |
|
|
|
// View User |
|
|
|
break; |
|
|
|
case 12: |
|
|
|
// Delete User |
|
|
|
break; |
|
|
|
case 13: |
|
|
|
// View Course List |
|
|
|
break; |
|
|
|
case 14: |
|
|
|
// Exit (includes saving data in the files) |
|
|
|
exit = true; |
|
|
|
System.out.println("Exiting..."); |
|
|
|