Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

OfficeHourSchedule class: public class OfficeHourSchedule { private ArrayList officeHours; /** * Constructor for objects of class OfficeHourSchedule */ public OfficeHourSchedule() { officeHours = new ArrayList();

image text in transcribed

OfficeHourSchedule class:

public class OfficeHourSchedule { private ArrayList officeHours;

/** * Constructor for objects of class OfficeHourSchedule */ public OfficeHourSchedule() { officeHours = new ArrayList(); addOfficeHoursFromFile("office.csv"); } /** * Prints names of instructors who have office hours on the given day * @param day The day of the week. */ public void printIsInOn(String day) { // put your code here } /** * Checks if instructor is available during the week for at least the given time * @param instructor The name of the instructor * @param minutes The time threashold * @return TRUE if instructor is available for the given threashold; otherwise FALSE */ public boolean isAvailableFor(String instructor, int minutes) { // put your code here return true; } /** * Add the office hours recorded in the given filename to the schedule. * @param filename A CSV file of OfficeHour records. */ private void addOfficeHoursFromFile(String filename) { OfficeHourReader reader = new OfficeHourReader(); officeHours.addAll(reader.getOfficeHours(filename)); }

/** * Prints for all office hours the corresponding info */ public void printAllOfficeHours() { for (OfficeHour officeh : officeHours) { officeh.printInfo(); System.out.println(); } } }

OfficeHour class:

public class OfficeHour { private String instructor; private String dayOfWeek; private int startTimeHours; private int startTimeMinutes; private int durationInMinutes; private String campus; private String office; private String course; // Ignore these two declarations private String minutesString; private String hoursString;

/** * Constructor for objects of class OfficeHour */ public OfficeHour(String instructor, String day, int startTimeH, int startTimeM, int duration, String campus, String office, String course) { this.instructor = instructor; dayOfWeek = day; startTimeHours = startTimeH; startTimeMinutes = startTimeM; durationInMinutes = duration; this.campus = campus; this.office = office; this.course = course; //ignore this part minutesString = startTimeM == 0 ? "00" : "" + startTimeM; hoursString = startTimeH

Use Lambda, Streams, filter, maps and reduce only!!!

In the class Office Hour Schedule, implement the following methods (documentation for each method is provided in the code). a) printisinOn(String day) b) isAvailableFor(String instructor, int minutes) Add a method (call it findinstructorsOnAfter) to Office HourSchedule that takes two parameters - campus and hour -- and returns a String containing the names of all instructors who offer an office hour on given campus that starts not before hour. You should exclude duplicate names (if an instructor offers multiple office hours). The string should start with "Instructors who are available on campus after hour.00 are: In the class Office Hour Schedule, implement the following methods (documentation for each method is provided in the code). a) printisinOn(String day) b) isAvailableFor(String instructor, int minutes) Add a method (call it findinstructorsOnAfter) to Office HourSchedule that takes two parameters - campus and hour -- and returns a String containing the names of all instructors who offer an office hour on given campus that starts not before hour. You should exclude duplicate names (if an instructor offers multiple office hours). The string should start with "Instructors who are available on campus after hour.00 are

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Building Database Driven Catalogs

Authors: Sherif Danish

1st Edition

0070153078, 978-0070153073

More Books

Students also viewed these Databases questions

Question

=+employee to take on the international assignment?

Answered: 1 week ago

Question

=+differences in home- and host-country costs of living?

Answered: 1 week ago