Package com.project.system
Class Menu
java.lang.Object
com.project.system.Menu
The
Menu class provides the user interface for the Student-Course Registration System.
It allows performing CRUD operations on students and courses using a console-based menu.-
Constructor Summary
ConstructorsConstructorDescriptionMenu()Constructs a newMenuinstance and initializes the MongoDB connection. -
Method Summary
Modifier and TypeMethodDescriptionprivate voidaddCourse(Scanner scanner, CourseService courseService) Adds a new course by taking input from the user.private voidaddStudent(Scanner scanner, StudentService studentService) Adds a new student by taking input from the user.private voiddeleteCourse(Scanner scanner, CourseService courseService) Deletes a course by name.private voiddeleteStudent(Scanner scanner, StudentService studentService) Deletes a student by ID.private voideditStudent(Scanner scanner, StudentService studentService) Edits the details of an existing student based on the user-provided ID.private voidsearchCourse(Scanner scanner, CourseService courseService) Searches for a course by name and displays the result.private voidsearchStudent(Scanner scanner, StudentService studentService) Searches for a student by ID and displays the result.
-
Constructor Details
-
Menu
public Menu()Constructs a newMenuinstance and initializes the MongoDB connection. It continuously displays the menu and processes user input until the program exits.
-
-
Method Details
-
addStudent
Adds a new student by taking input from the user.- Parameters:
scanner- The scanner to read user input.studentService- The service for managing student operations.
-
editStudent
Edits the details of an existing student based on the user-provided ID.- Parameters:
scanner- The scanner to read user input.studentService- The service for managing student operations.
-
deleteStudent
Deletes a student by ID.- Parameters:
scanner- The scanner to read user input.studentService- The service for managing student operations.
-
searchStudent
Searches for a student by ID and displays the result.- Parameters:
scanner- The scanner to read user input.studentService- The service for managing student operations.
-
addCourse
Adds a new course by taking input from the user.- Parameters:
scanner- The scanner to read user input.courseService- The service for managing course operations.
-
deleteCourse
Deletes a course by name.- Parameters:
scanner- The scanner to read user input.courseService- The service for managing course operations.
-
searchCourse
Searches for a course by name and displays the result.- Parameters:
scanner- The scanner to read user input.courseService- The service for managing course operations.
-