Question
This program will require you to create a program that will allow faculty members to post their course and office hour schedules. First of all,
This program will require you to create a program that will allow faculty members to post their course and office hour schedules.
First of all, this project utilizes enumerated types which help your programs readability. Here is an example:
public enum DaysOfWeek { SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY; }
The code above would appear in a separate file named DaysOfWeek.java and would serve as the data type for variables that could only have the values: SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY. Notice, these are not Strings! Internally, SUNDAY=0, MONDAY=1, TUESDAY=2, WEDNESDAY=3, THURSDAY=4, FRIDAY=5, SATURDAY=6. However, the enumerated type is more elegant way of representing these values. The following examples should also prove helpful to you:
DaysOfWeek firstDayOfWeek = DaysOfWeek.SUNDAY;
You can also retrieve the String value of an enumeration. The following example would give the String value the value "SUNDAY":
String value = firstDayOfWeek.name();
UML Class Diagrams
Here are the UML Class Diagrams for the classes you must implement in Java. You are free to add additional private methods if needed.
The method getFormatedTimeBlock() should return a string in the following format:
startTime - endTime comments location (e.g. 1200 - 1300 COMP167 ACB 207 )
The method getCalendar() should return all course items, office hour items and appointment items. Each item (i.e. formatted TimeBlock) should be listed under a heading with the day of the week. Within a particular day, the items should be listed in sorted order by time (Hint: Sorting is not necessary -- use a loop that goes from 5 to 2400 by 5's.).
The toString() method
The toString method should return a String formatted as in the input file. Notice that TimeBlock.toString() will not include the location or comment properties. Most classes will have each property on a new line, TimeBlock properties will be separated by a comma.
Hanlding ArrayLists
Each ArrayList should have five associated methods to perform: getNum, add, get, set and remove. So if you have an ArrayList named widgets that stored items of type Widget, then the associated UML would be:
+getNumWidgets() : int //Return the number of items in the ArrayList widgets. +getWidget(index:int) : Widget //get the Widget at location index in ArrayList widgets +setWidget(index:int, item:Widget):void //store item at location index in the ArrayList widgets. +addWidget(item:Widget):void //Append the Widget to the ArrayList. +removeWidget(index:int):Widget //remove the Widget stored at the given index and return it
Input File
The input file will be supplied to your main() method using command-line arguments. Your labs have covered how to use command-line arguments to pass information to your program. Your main() method should check to see if a file is passed to it. If there is no supplied input file, your program should present the user with the JFileChooser to allow them to select one. The format for the input file is shown below:
Department Name College Name University Name Faculty0 First Name Faculty0 Last Name Faculty0 Office Location Faculty0 Number of Courses Course0 Name Course0 Location Course0 Number of meeting days Course0 Day of the week, Start_Time, End_Time * repeat for other days * repeat for other courses Faculty0 Number of office hour sessions Office Hours0 Day of the week, Start_Time, End_Time * Repeat for other office hours. Faculty0 Number of Appointments Appointments0 Description Appointments0 Day of the week, Start_Time, End_Time * Repeat for other appointments. * Repeat for other faculty The file will end when there are no more faculty.
You should also reference the input file provided in this repository.
Notes
- When outputting office hour information, use the string Office Hours as a description.
- All start and end times will be a multiple of 5.
Output File
The format of the output file is the same as the input file. If you have created the toString() method for the Department class correctly, the produced String should match the input/output format. This should make this method trivial to write.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started