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 newMenu
instance and initializes the MongoDB connection. -
Method Summary
Modifier and TypeMethodDescriptionprivate void
addCourse
(Scanner scanner, CourseService courseService) Adds a new course by taking input from the user.private void
addStudent
(Scanner scanner, StudentService studentService) Adds a new student by taking input from the user.private void
deleteCourse
(Scanner scanner, CourseService courseService) Deletes a course by name.private void
deleteStudent
(Scanner scanner, StudentService studentService) Deletes a student by ID.private void
editStudent
(Scanner scanner, StudentService studentService) Edits the details of an existing student based on the user-provided ID.private void
searchCourse
(Scanner scanner, CourseService courseService) Searches for a course by name and displays the result.private void
searchStudent
(Scanner scanner, StudentService studentService) Searches for a student by ID and displays the result.
-
Constructor Details
-
Menu
public Menu()Constructs a newMenu
instance 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.
-