Browse Source

refactoring: updated Menu to better readability of extended project

remotes/origin/fdai7780
fdai7600 11 months ago
parent
commit
2cf158923f
  1. 80
      src/main/java/org/example/Main.java

80
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();
}
}
Loading…
Cancel
Save