Browse Source

Implemented Initialize Dummy Data function in Main

remotes/origin/fdai7780
fdai7887 11 months ago
parent
commit
4a8249ef27
  1. 24
      src/main/java/org/example/Main.java

24
src/main/java/org/example/Main.java

@ -7,7 +7,7 @@ public class Main {
Administration administration = new Administration(); Administration administration = new Administration();
Scanner scanner = new Scanner(System.in); Scanner scanner = new Scanner(System.in);
boolean exit = false; boolean exit = false;
boolean DummyDataExists = false;
while (!exit) { while (!exit) {
System.out.println("\n--- Student Management System Menu ---"); System.out.println("\n--- Student Management System Menu ---");
System.out.println("1. Register Student"); System.out.println("1. Register Student");
@ -47,9 +47,31 @@ public class Main {
case 7: case 7:
System.out.println("Dummy data initialized."); System.out.println("Dummy data initialized.");
Student student1 = new Student("Mark", "S1001", "Student");
Student student2 = new Student("Sebastian", "S1002", "Student");
administration.addStudents(student1);
administration.addStudents(student2);
Professor prof1 = new Professor("Joachim", "P1001", "Professor");
Professor prof2 = new Professor("Herbert", "P1002", "Professor");
administration.addProfessor(prof1);
administration.addProfessor(prof2);
Admin admin1 = new Admin ("Peter", "A1001", "Admin");
Admin admin2 = new Admin ("Martin", "A1002", "Admin");
administration.addAdmin(admin1);
administration.addAdmin(admin2);
Course.addCourse("Math", "C1001", 5, "courseData.txt");
Course.addCourse("English", "C1002", 6, "courseData.txt");
DummyDataExists = true;
break; break;
case 8: case 8:
if (DummyDataExists){
Course.deleteCourse("courseData.txt");
Course.deleteCourse("courseData.txt");
}
exit = true; exit = true;
System.out.println("Exiting..."); System.out.println("Exiting...");
break; break;

Loading…
Cancel
Save