Question: Answer B and C isider a class management system where courses offered for enrollment each have one or re sections. Students can be registered in
Answer B and C 



isider a class management system where courses offered for enrollment each have one or re sections. Students can be registered in only one section of a particular course, given that the ing does not overlap with any previously registered course. Once enrolled, they should be able iee the list of courses they are enrolled in. Similarly, teachers and TAs should be able to see the of sections they are assigned to and a list of students present in those sections. However, only chers can remove a student from their section. Design a UML diagram to represent the classes and their relationships as given above. [15] evelop a JAVA program that will handle the mentioned requirements following the guidelines ow: [80] ote: You cannot use any other JAVA library classes except Array, AnrayL Hst, Scanner and Date.) Use this "Sesslon" class to store the database and invoke its methods when you need access to the database. //A class to access the singular database and scanner instance class Session\{ private static Session session = null; private User userList[] = new User[7]; private Course courselist[] = new Course[6]; public Scanner inputScanner = new Scanner(System.in); private Session O{ createDatabaseO;; \} private static void createDatabase O{ //place your database building code here public static Session getSession O{ if (session = = null) session = new Session 0 ; return session; public Course[] getCourselist O{ return courseList; \} public User[] getUserList O return userList; ? class CourseManagement \{ public static void main(String[ args)\{ while(true)\{ //copy the following line wherever you need a session instance Session session = Session.getSession(); System.out.print("Email:"); String email = session.inputScanner.nextLineO; System.out.print("Password:"); String password = session.inputScanner.nextLine(); //place rest of your code here \} public static User login(String email, String password) throws Exception\{ //place your login logic here //for wrong credential: throw new Exception("User not found"); //call getMessage() on the exception instance to get the error message \} Note: You don't need to include "Session" or "CourseManagement" class in your UML diagram.) Each role has their own sets of features they can access from the program. For example, a student can do three things, e.g. add or remove a course, view course list. After login, a function has to be called to view all of the actions and perform the action specific user requests from the system. Implement this by using the following interface with the appropriate class/classes: interface Action \{ public void handleActions(); void addCourse(Student, Course), void removeCourse (Student, Course), void viewCourse/ Course[] viewCourse: Invoke them according to the option selected by the user. They should all be static methods either in your execution class. Notice that viewCourse function is common for student, teacher and TA, however, it has different definitions. (Hint: You may achieve this by implementing polymorphism to the method argument, or better option, through method overloading) void addStudent(Student), void removeStudent(Student), void viewStudentlistO/ Student[ ] viewStudentListO: These functions should be present in "Course" class and must be utilized appropriately. The student capacity for a course can be 5 . - Address a few error cases. For example, making sure a student isn't being enrolled into different sections of the same course. Also, be careful about invoking static methods and make sure to avoid IndexOutofBoundException and NullPointerException. - Put the entire program in an infinite loop and place option at every stage to go back to its previous stage. (Hint: place every stage inside a different function so that you may exit and enter the function as needed. Sometimes, recursion may work better than a loop. Note that, void function can also use return.) - Use meaningful identifiers for methods and variables - Use comments where necessary - Avoid repetitive code or adding anything unnecessary. Bonus 5 marks for neat and concise code, and sticking to the guidelines. - Your test data (database) should be as follows: TA should also use the above program flow, but won't have the "Remove Student" option. For Student, follow this sample: c. Explain how and why the concept of inheritance, abstraction and polymorphism has been implemented within the program. [5]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
