-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
54 lines (44 loc) · 1.94 KB
/
Copy pathMain.java
File metadata and controls
54 lines (44 loc) · 1.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import java.io.*;
import java.nio.charset.StandardCharsets;
// Entry point of the student management system
public class Main {
public static void main(String[] args) {
// Input file paths provided via command-line arguments
String personFile = args[0];
String departmentFile = args[1];
String programFile = args[2];
String courseFile = args[3];
String assignmentFile = args[4];
String gradeFile = args[5];
String outputFile = args[6];
// Initializes the core system
StudentManagementSystem sms = new StudentManagementSystem();
// Uses try-with-resources to safely manage writer
try (BufferedWriter writer = new BufferedWriter(
new OutputStreamWriter(new FileOutputStream(outputFile), StandardCharsets.UTF_8))) {
// Load person records (students and faculty)
writer.write("Reading Person Information \n");
sms.loadPersons(personFile, writer);
// Load department definitions
writer.write("Reading Departments \n");
sms.loadDepartments(departmentFile, writer);
// Load academic programs
writer.write("Reading Programs \n");
sms.loadPrograms(programFile, writer);
// Load course offerings
writer.write("Reading Courses \n");
sms.loadCourses(courseFile, writer);
// Load course-student and course-faculty assignments
writer.write("Reading Course Assignments \n");
sms.loadAssignments(assignmentFile, writer);
// Load student grades
writer.write("Reading Grades \n");
sms.loadGrades(gradeFile, writer);
// Write the final report output
sms.writeOutput(writer);
} catch (IOException e) {
// Handles file I/O errors
System.out.println("An error occurred: " + e.getMessage());
}
}
}