Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

System Implementation (Phase 3) The user interface has been written for you in W

ID: 3692545 • Letter: S

Question

System Implementation (Phase 3)

The user interface has been written for you in WebRegApp.java. This program handles all keyboard and file input, and all screen output. You will complete the following methods in WebReg.java, which are designed to perform actions such as searching and sorting the catalog.

WebRegApp.java first reads the catalog (a list of courses) from catalog.txt. The catalog will be represented as an array of Course objects. WebRegApp reads the catalog from the file catalog.txt - you may edit this file if you wish. If you add entries to it, be sure they follow the same format as the entries already in the file. It then shows the user a menu from which they can choose various options. In most cases, WebRegApp will call methods from WebReg to execute the option chosen by the user. *ignore options 3 & 4 – you do not need to implement those methods until the next milestone.

Courses for which the student registers should be placed into the student’s schedule array starting at index 0. Empty (unused) entries in the array should remain null; all empty entries should be on the right side of the array (there should be no "gaps" between used entries). For example, since the maximum number of courses allowed is 6 and if the student is currently taking 3 courses, the schedule array would be of size 6, entries 0 through 2 would contain Course objects, and entries 3 through 5 would contain null. This should be the case regardless of the sequence of adds and drops the student performed in order to create his or her current schedule. The same concept applies for the roster of students for a specific course.

Implement the following methods in WebReg.java.

DO NOT modify WebRegApp.java or your Period, Course, and Student objects. If needed, you may add helper methods and fields in WebReg.java.

public static Course lookupCourseByName(Course[] catalog, String courseName)

search for the course with the given name in the catalog, and return the corresponding Course object.

if the course is not found, return null.

*you may ignore the letter casing of the course name – in other words, if courseName is all uppercase but the name of the course in the catalog is all lowercase, it would still be a match.

public static Course[] lookupCoursesByDept(Course[] catalog, int department)

search for all courses offered by the given department in the catalog, and return the corresponding Course objects in a new array (in any order).

the returned array should be just large enough to hold the results, and no larger; it should not contain any empty (null) entries.

if no courses are found with that department number, return null.

public static int countCredits(Student s)

compute the student's current total credit load.

public static boolean addCourse(Student s, Course c)

attempt to add a course, c, to the student's schedule.

put the Course object into the student’s schedule in the first free slot (null entry), update the courses’ roster, and return true.

if the student is not allowed to register for this course (for any reason), return false and do not alter the student’s schedule or the courses’ roster.

public static boolean dropCourse(Student s, Course c)

attempt to remove a course, c, from the student's schedule.

search for the Course object in the student's schedule.

if you find the Course object in the student’s schedule, remove it from the student’s schedule, update the courses’ roster, making sure not to create any "gaps" (null entries between used entries), and return true.

if you cannot find the course in the student's schedule or the student is not in the courses’ roster, return false.

WebReg.java

Explanation / Answer

As the implementation of the classes Course, Student is not provided, I can do only these following methods. For rest of the methods, the required classes structure need to be know.