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

//DRIVER public class Driver { // Build the objects needed to represent the regi

ID: 3605657 • Letter: #

Question

//DRIVER

public class Driver {

// Build the objects needed to represent the registration process

Catalog catalog = new Catalog();

Term term = new Term(""); // change to the current term

Faculty faculty = new Faculty();

// Populate these objects

createInstructors(faculty); // Send the faculty object to method for instructor population

createCourses(catalog); // Send the catalog object to method for course population

}

private static void createInstructors(Faculty faculty) {

faculty.addInstructor(new Instructor(101, "Johnson"));

faculty.addInstructor(new Instructor(102, "Kay"));

faculty.addInstructor(new Instructor(103, "Xu"));

faculty.addInstructor(new Instructor(104, "Mulligan"));

faculty.addInstructor(new Instructor(105, "Muldoon"));

faculty.addInstructor(new Instructor(106, "Stanzione"));

faculty.addInstructor(new Instructor(107, "Brady"));

faculty.addInstructor(new Instructor(108, "Sawyer"));

faculty.addInstructor(new Instructor(109, "Brown"));

faculty.addInstructor(new Instructor(110, "Harrison"));

faculty.addInstructor(new Instructor(111, "Ford"));

faculty.addInstructor(new Instructor(112, "Danzinger"));

faculty.addInstructor(new Instructor(113, "Clarke"));

faculty.addInstructor(new Instructor(114, "Abraham"));

faculty.addInstructor(new Instructor(115, "Perkowski"));

faculty.addInstructor(new Instructor(116, "Brando"));

}

private static void createCourses(Catalog catalog) {

catalog.addCourse(new Course("ART 01.101", "Art Appreciation", Department.Art));

catalog.addCourse(new Course("ART 01.201", "Painting with Oils", Department.Art));

catalog.addCourse(new Course("ART 01.202", "Painting with Water Colors", Department.Art));

catalog.addCourse(new Course("BIOL 01.110", "Genetics", Department.Biology));

catalog.addCourse(new Course("BIOL 04.301", "Anatomy and Physiology", Department.Biology));

catalog.addCourse(new Course("CHEM 01.101", "Introduction to Chemistry", Department.Chemistry));

catalog.addCourse(new Course("CHEM 01.201", "Organic Chemistry", Department.Chemistry));

catalog.addCourse(new Course("CHEM 01.301", "Analytical Chemistry", Department.Chemistry));

catalog.addCourse(new Course("CSC 04.114", "Object Oriented Programming", Department.Computer_Science));

catalog.addCourse(new Course("CSC 04.301", "Human Computer Interaction", Department.Computer_Science));

catalog.addCourse(new Course("CSC 07.211", "Artificial Intelligence", Department.Computer_Science));

catalog.addCourse(new Course("CSC 04.370", "Software Engineering", Department.Computer_Science));

catalog.addCourse(new Course("CSC 04.210", "Data Structures and Algorithms", Department.Computer_Science));

catalog.addCourse(new Course("ECON 01.101", "Microeconomics", Department.Economics));

catalog.addCourse(new Course("HIS 01.101", "Western Civilization", Department.History));

catalog.addCourse(new Course("HIS 01.331", "Civil Wars", Department.History));

catalog.addCourse(new Course("MUS 01.214", "The Genres of Rock Music", Department.Music));

catalog.addCourse(new Course("PHIL 01.111", "Ethics", Department.Philosophy));

catalog.addCourse(new Course("PHIL 01.221", "Existentialism", Department.Philosophy));

catalog.addCourse(new Course("PHY 02.121", "Introduction to Mechanics", Department.Physics));

catalog.addCourse(new Course("PSY 04.114", "Abnormal Psychology", Department.Psychology));

}

}

WITH THE HELP OF ABOVE GIVEN DRIVER CREATE FOLLOWING CLASSES
a. Faculty: Basically an ArrayList of Instructors. Please create a method addInstructor() to add an Instructor instance to the ArrayList.

b. Catalog: Basically an ArrayList of Courses. Please create a method addCourse() to add a Course instance to the ArrayList.

c. Course: A course should contain the following instance variables: i. courseNumber (String), ii. title (String), iii. department (Department)

d. Section: A section should contain the following instance variables: i. crn (Integer), < CRNs should be automatically generated, starting at 40001. > ii. course (Course), iii. instructor (Instructor)
Sections might have Timeslots. A Timeslot should have the following instance variables: i. weekday (java.time.DayOfWeek), ii. startTime (java.time.LocalTime), iii. endTime (java.time.LocalTime)

f. There are three kinds of Sections: i. Traditional: Traditional sections have a list of TimeSlots (in our case, two). ii. Hybrid: Hybrid sections meet once a week (the other meeting is online) and have a single Timeslot. iii. Online: Online sections have no Timeslot

g. Term: Basically an ArrayList of Sections plus a String field for the actual term, e.g. “Fall 2017. ” Please create a method addSection() to add a Section instance to the ArrayList.

**IMPORTANT**

In the driver You will need to create a collection of Timeslots that consist of 50 minute time slots that begin on the hour from 8 am Monday to 6 pm on Friday. java.time.DayOfWeek might be a helpful class to include. For instance: i. Monday 9:00 to 9:50 ii. Monday 10:00 to 10:50 iii. … iv. Monday 18:00 to 18:50 v. Tuesday 9:00 to 9:50 vi. Tuesday 10:00 to 10:50 vii. …

Explanation / Answer

1)

package main.webapp;

public class Driver {

// Build the objects needed to represent the registration process

public static void main(String[] args) {

Term term = new Term("Traditional"); // change to the current term

Faculty faculty = new Faculty();

// Populate these objects

createInstructors(faculty); // Send the faculty object to method for

// instructor population

Catalog catalog = new Catalog();

createCourses(catalog); // Send the catalog object to method for course

// population

Section section = new Section();

Timeslots timeslot = new Timeslots(java.time.DayOfWeek.MONDAY, java.time.LocalTime.of(9, 0),

java.time.LocalTime.of(9, 50));

section.addTimeslot(timeslot);

Timeslots timeslot1 = new Timeslots(java.time.DayOfWeek.MONDAY, java.time.LocalTime.of(10, 0),

java.time.LocalTime.of(10, 50));

section.addTimeslot(timeslot1);

term.addSection(section);

}

private static void createInstructors(Faculty faculty) {

faculty.addInstructor(new Instructor(101, "Johnson"));

faculty.addInstructor(new Instructor(102, "Kay"));

faculty.addInstructor(new Instructor(103, "Xu"));

faculty.addInstructor(new Instructor(104, "Mulligan"));

faculty.addInstructor(new Instructor(105, "Muldoon"));

faculty.addInstructor(new Instructor(106, "Stanzione"));

faculty.addInstructor(new Instructor(107, "Brady"));

faculty.addInstructor(new Instructor(108, "Sawyer"));

faculty.addInstructor(new Instructor(109, "Brown"));

faculty.addInstructor(new Instructor(110, "Harrison"));

faculty.addInstructor(new Instructor(111, "Ford"));

faculty.addInstructor(new Instructor(112, "Danzinger"));

faculty.addInstructor(new Instructor(113, "Clarke"));

faculty.addInstructor(new Instructor(114, "Abraham"));

faculty.addInstructor(new Instructor(115, "Perkowski"));

faculty.addInstructor(new Instructor(116, "Brando"));

}

private static void createCourses(Catalog catalog) {

catalog.addCourse(new Course("ART 01.101", "Art Appreciation", Department.Art));

catalog.addCourse(new Course("ART 01.201", "Painting with Oils", Department.Art));

catalog.addCourse(new Course("ART 01.202", "Painting with Water Colors", Department.Art));

catalog.addCourse(new Course("BIOL 01.110", "Genetics", Department.Biology));

catalog.addCourse(new Course("BIOL 04.301", "Anatomy and Physiology", Department.Biology));

catalog.addCourse(new Course("CHEM 01.101", "Introduction to Chemistry", Department.Chemistry));

catalog.addCourse(new Course("CHEM 01.201", "Organic Chemistry", Department.Chemistry));

catalog.addCourse(new Course("CHEM 01.301", "Analytical Chemistry", Department.Chemistry));

catalog.addCourse(new Course("CSC 04.114", "Object Oriented Programming", Department.Computer_Science));

catalog.addCourse(new Course("CSC 04.301", "Human Computer Interaction", Department.Computer_Science));

catalog.addCourse(new Course("CSC 07.211", "Artificial Intelligence", Department.Computer_Science));

catalog.addCourse(new Course("CSC 04.370", "Software Engineering", Department.Computer_Science));

catalog.addCourse(new Course("CSC 04.210", "Data Structures and Algorithms", Department.Computer_Science));

catalog.addCourse(new Course("ECON 01.101", "Microeconomics", Department.Economics));

catalog.addCourse(new Course("HIS 01.101", "Western Civilization", Department.History));

catalog.addCourse(new Course("HIS 01.331", "Civil Wars", Department.History));

catalog.addCourse(new Course("MUS 01.214", "The Genres of Rock Music", Department.Music));

catalog.addCourse(new Course("PHIL 01.111", "Ethics", Department.Philosophy));

catalog.addCourse(new Course("PHIL 01.221", "Existentialism", Department.Philosophy));

catalog.addCourse(new Course("PHY 02.121", "Introduction to Mechanics", Department.Physics));

catalog.addCourse(new Course("PSY 04.114", "Abnormal Psychology", Department.Psychology));

}

}

...........................................................

2)

package main.webapp;

import java.util.ArrayList;

public class Faculty {

private ArrayList<Instructor> instructorList;

public Faculty() {

if (instructorList == null) {

instructorList = new ArrayList<Instructor>();

}

}

public void addInstructor(Instructor instructor) {

instructorList.add(instructor);

}

}

...................................................................

3)

package main.webapp;

public class Course {

private String courseNumber;

private String title;

private String department;

public Course(String courseNumber, String title, String department) {

this.courseNumber = courseNumber;

this.title = title;

this.department = department;

}

/**

* @return the courseNumber

*/

public String getCourseNumber() {

return courseNumber;

}

/**

* @param courseNumber

* the courseNumber to set

*/

public void setCourseNumber(String courseNumber) {

this.courseNumber = courseNumber;

}

/**

* @return the title

*/

public String getTitle() {

return title;

}

/**

* @param title

* the title to set

*/

public void setTitle(String title) {

this.title = title;

}

/**

* @return the department

*/

public String getDepartment() {

return department;

}

/**

* @param department

* the department to set

*/

public void setDepartment(String department) {

this.department = department;

}

}

........................................................................................

4)

package main.webapp;

import java.util.ArrayList;

public class Catalog {

private ArrayList<Course> catalogList;

public void addCourse(Course course) {

catalogList.add(course);

}

public Catalog() {

if (catalogList == null) {

catalogList = new ArrayList<Course>();

}

}

}

...........................................................................................

5)

package main.webapp;

import java.util.ArrayList;

public class Section {

private static int crn = 40001;

private Course course;

private Instructor instructor;

private ArrayList<Timeslots> timeslots = new ArrayList<Timeslots>();

public void addTimeslot(Timeslots timeslot) {

timeslots.add(timeslot);

}

/**

* @return the crn

*/

public static int getCrn() {

return crn++;

}

/**

* @param crn

* the crn to set

*/

public static void setCrn(int crn) {

Section.crn = crn;

}

/**

* @return the course

*/

public Course getCourse() {

return course;

}

/**

* @param course

* the course to set

*/

public void setCourse(Course course) {

this.course = course;

}

/**

* @return the instructor

*/

public Instructor getInstructor() {

return instructor;

}

/**

* @param instructor

* the instructor to set

*/

public void setInstructor(Instructor instructor) {

this.instructor = instructor;

}

/**

* @return the timeslots

*/

public ArrayList<Timeslots> getTimeslots() {

return timeslots;

}

/**

* @param timeslots

* the timeslots to set

*/

public void setTimeslots(ArrayList<Timeslots> timeslots) {

this.timeslots = timeslots;

}

}

.........................................................................

6)

package main.webapp;

import java.util.ArrayList;

public class Term {

private String actual_term;

private ArrayList<Section> sections = new ArrayList<Section>();

public Term(String actual_term) {

this.actual_term = actual_term;

}

public void addSection(Section section) {

sections.add(section);

}

/**

* @return the actual_term

*/

public String getActual_term() {

return actual_term;

}

/**

* @param actual_term

* the actual_term to set

*/

public void setActual_term(String actual_term) {

this.actual_term = actual_term;

}

/**

* @return the sections

*/

public ArrayList<Section> getSections() {

return sections;

}

/**

* @param sections

* the sections to set

*/

public void setSections(ArrayList<Section> sections) {

this.sections = sections;

}

}

....................................................

7)

package main.webapp;

public class Instructor {

private int instructorId;

private String instructorName;

public Instructor(int instructorId, String instructorName) {

this.instructorId = instructorId;

this.instructorName = instructorName;

}

/**

* @return the instructorId

*/

public int getInstructorId() {

return instructorId;

}

/**

* @param instructorId

* the instructorId to set

*/

public void setInstructorId(int instructorId) {

this.instructorId = instructorId;

}

/**

* @return the instructorName

*/

public String getInstructorName() {

return instructorName;

}

/**

* @param instructorName

* the instructorName to set

*/

public void setInstructorName(String instructorName) {

this.instructorName = instructorName;

}

}

.............................................................

8)

package main.webapp;

import java.time.DayOfWeek;

import java.time.LocalTime;

public class Timeslots {

private DayOfWeek weekday;

private LocalTime startTime;

private LocalTime endTime;

public Timeslots(DayOfWeek weekday, LocalTime startTime, LocalTime endTime) {

this.endTime = endTime;

this.startTime = startTime;

this.weekday = weekday;

}

/**

* @return the weekday

*/

public DayOfWeek getWeekday() {

return weekday;

}

/**

* @param weekday

* the weekday to set

*/

public void setWeekday(DayOfWeek weekday) {

this.weekday = weekday;

}

/**

* @return the startTime

*/

public LocalTime getStartTime() {

return startTime;

}

/**

* @param startTime

* the startTime to set

*/

public void setStartTime(LocalTime startTime) {

this.startTime = startTime;

}

/**

* @return the endTime

*/

public LocalTime getEndTime() {

return endTime;

}

/**

* @param endTime

* the endTime to set

*/

public void setEndTime(LocalTime endTime) {

this.endTime = endTime;

}

}

...............................................................................

9)

package main.webapp;

public class Department {

public static final String Art = "Art";

public static final String Biology = "Biology";

public static final String Chemistry = "Chemistry";

public static final String Computer_Science = "Computer_Science";

public static final String Economics = "Economics";

public static final String History = "History";

public static final String Philosophy = "Philosophy";

public static final String Music = "Music";

public static final String Physics = "Physics";

public static final String Psychology = "Psychology";

}