From 2cf158923fdd151ed6d8c0ae4e00218746e46b80 Mon Sep 17 00:00:00 2001 From: fdai7600 Date: Thu, 8 Feb 2024 17:51:42 +0100 Subject: [PATCH] refactoring: updated Menu to better readability of extended project --- src/main/java/org/example/Main.java | 80 +++++++++++++++++------------ 1 file changed, 48 insertions(+), 32 deletions(-) diff --git a/src/main/java/org/example/Main.java b/src/main/java/org/example/Main.java index 296c1ce..f41f76d 100644 --- a/src/main/java/org/example/Main.java +++ b/src/main/java/org/example/Main.java @@ -3,72 +3,88 @@ import java.util.Scanner; public class Main { - public static final String courseData_file = "courseData.txt"; - public static void main(String[] args) {System.out.println("Hello world!"); + public static final String courseDataFile = "courseData.txt"; + public static final String userDataFile = "userData.txt"; + public static final String professorDataFile = "professorData.txt"; + public static final String studentDataFile = "studentData.txt"; + + public static void main(String[] args) { + System.out.println("Hello world!"); Administration administration = new Administration(); Scanner scanner = new Scanner(System.in); boolean exit = false; - boolean DummyDataExists = false; + boolean dummyDataExists = false; + while (!exit) { System.out.println("\n--- Student Management System Menu ---"); - System.out.println("1. Register Student"); + System.out.println("1. Register User"); System.out.println("2. Enroll Student in Course"); - System.out.println("3. Add Course"); - System.out.println("4. Delete Course"); - System.out.println("5. Assign Grade"); - System.out.println("6. View Grades"); - System.out.println("7. Initialize with Dummy Data"); - System.out.println("8. Exit"); + System.out.println("3. Enroll Prof to Course"); + System.out.println("4. Drop Prof from Course"); + System.out.println("5. Drop Student from Course"); + System.out.println("6. Create Course"); + System.out.println("7. Delete Course"); + 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.print("Select an option: "); int choice = scanner.nextInt(); switch (choice) { case 1: - System.out.println("Register User selected"); - administration.registerUser(); + // Register User break; case 2: - System.out.println("Enter Student ID and Course Code to enroll:"); + // Enroll Student in Course break; case 3: - System.out.println("Add Course selected"); - Course.addCourseFromUserInput(courseData_file); + // Enroll Prof to Course break; case 4: - System.out.println("Delete Course selected"); - Course.deleteCourse(courseData_file); + // Drop Prof from Course break; case 5: - System.out.println("Assign Grade selected"); + // Drop Student from Course break; - case 6: - System.out.println("View Grades selected"); + // Create Course break; - case 7: - if(!DummyDataExists){ - administration.initializeDummyData(); - System.out.println("Dummy data initialized."); - DummyDataExists = true; - } - else{System.out.println("Dummy Data already exists");} + // Delete Course break; - case 8: - + // View Courses + break; + case 9: + // Assign Grade to Student + break; + case 10: + // View Grades from Student + 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..."); break; - default: System.out.println("Invalid option, please try again."); - } } scanner.close(); - } } \ No newline at end of file