Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In Java: Introduction This program will require you to create a program that will allow faculty members to post their course and office hour schedules.

In Java:

Introduction

This program will require you to create a program that will allow faculty members to post their course and office hour schedules.

Enumeration

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.

image text in transcribed

The method getFormatedTimeBlock() should return a string in the following format:

startTime - endTime comments location (e.g. 1200 - 1300 COMP167 ACB 207 ) 

image text in transcribed

image text in transcribed

image text in transcribed

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.).

image text in transcribed

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.

Grading

You must create a driver program (main() method) for each level that demonstrates that the all the functionality of that level works correctly. You must push your work to GitHub and open a GitHub pull request for EACH level.

Level 1: 25 points

Complete the DaysOfWeek enumerated type, the TimeBlock class, the Course class and the Appointment class. Write a simple driver program that will instantiate an object of each class type, populate the data fields and test the other methods of the classes. Display your output in a JavaFX Dialog.

Level 2: 10 points

Complete all of the Faculty class except for the getCalendar() and atAGlance() methods.

Level 3: 20 points

Complete all of the Department class except for the loadDepartmentData() and saveDepartmentData() classes.

Level 4: 30 points

Implement the loadDepartmentData() and saveDepartmentData() methods. Your main() method should obtain the input file name from the command-line arguments. Also, your main() should prompt the user for an input file name if no command-line argument is passed.

Level 5: 15 points

Implement the getCalender() and atAGlance() methods.

departmentData.txt:

Computer Science Department College of Engineering NC A&T State University Kelvin Bryant 303 Cherry Hall 3 GEEN165 Sections 1 & 2 210 Graham Hall 3 Monday, 1100, 1150 Wednesday, 1100, 1150 Friday, 1100, 1150 COMP755 Section 1 129 McNair Hall 2 Monday, 1500, 1615 Wednesday, 1500, 1615 GEEN165 Section 3 210 Graham Hall 3 Monday, 1200, 1250 Wednesday, 1200, 1250 Friday. 1200, 1250 4 Monday, 1330, 1430 Tuesday, 1300, 1600 Wednesday, 1330, 1430 Thursday, 1300, 1600 2 Eat Lunch Monday, 1300, 1330 Eat Lunch Wednesday, 1300, 1330 Kenneth Williams 503 McNair Hall 2 GEEN163 Sections 1 & 2 210 Graham Hall 3 Monday, 900, 950 Wednesday, 900, 950 Friday, 900, 950 GEEN163 Section 3 & 4 210 Graham Hall 3 Monday, 1000, 1050 Wednesday, 1000, 1050 Friday, 1000, 1050 3 Monday, 1200, 1600 Wednesday, 1200, 1400 Friday, 1400, 1700 0 

I need it by Feb 25 or 26 so I can test it.

EDIT: Adding UML diagrams

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

Appointment description:String timeBlock:TimeBlock Description of the appointment day and times of appointment +Appointment() +//mutator and accessor methods Set defaults and instantiate the TimeBlock +toString():String Use same format as the input file Course -courseName:String location:String timeBlocks:ArrayList Course name Building and room number where course is conducted Course days and meeting times. +Course() +//mutator and accessor methods +toString():String Set defaults and instantiate the ArrayList Use same format as the input file Department -departmentName:String -unitName:String -universityName: String faculty:ArrayList Name of the department (e.g. Computer Science) Name of the unit/college (e.g. Engineering) Name of the University All of the faculty in the department +Depatment() Default values for properties, instantiate each ArrayList See "Handling ArrayList" section +//mutator and accessor methods +loadDepartmentData( String inputFileName) void +saveDepartmentData( String outputFileName ): voidWrite bank data to a file (See note below on output file) +atAGlance( int time) : String Read in the bank data from a file (See note below on input file) Returns a string showing what each Faculty member is doing at the given time. Creates a string with all Department that matches the format of the input file (See input file section) +toString():String Faculty firstName:String lastName:String -officeLocation:String -courses:ArrayList -officeHours:ArrayList -appointments:ArrayList Faculty first name Faculty last name Campus building and office number Information on courses taught. Information on office hour sessions. Information on miscellaneous appointments and meetings. +Faculty() +//mutator and accessor methods +getCalendar() : String +toString():String Set defaults and instantiate the ArrayList See "Handling ArrayList" See note below. Use same format as the input file TimeBlock -day:DaysOfWeek startTime:int -endTime:int -comments:String -location:String +TimeBlock( +//mutator and accessor methods +getFormatedTimeBlock(): String +toString():String Day of time block Start time of block End time of block Comments about the time block. Location where the time block is spent Set defaults See Comment below. Use same format as the input file. Appointment description:String timeBlock:TimeBlock Description of the appointment day and times of appointment +Appointment() +//mutator and accessor methods Set defaults and instantiate the TimeBlock +toString():String Use same format as the input file Course -courseName:String location:String timeBlocks:ArrayList Course name Building and room number where course is conducted Course days and meeting times. +Course() +//mutator and accessor methods +toString():String Set defaults and instantiate the ArrayList Use same format as the input file Department -departmentName:String -unitName:String -universityName: String faculty:ArrayList Name of the department (e.g. Computer Science) Name of the unit/college (e.g. Engineering) Name of the University All of the faculty in the department +Depatment() Default values for properties, instantiate each ArrayList See "Handling ArrayList" section +//mutator and accessor methods +loadDepartmentData( String inputFileName) void +saveDepartmentData( String outputFileName ): voidWrite bank data to a file (See note below on output file) +atAGlance( int time) : String Read in the bank data from a file (See note below on input file) Returns a string showing what each Faculty member is doing at the given time. Creates a string with all Department that matches the format of the input file (See input file section) +toString():String Faculty firstName:String lastName:String -officeLocation:String -courses:ArrayList -officeHours:ArrayList -appointments:ArrayList Faculty first name Faculty last name Campus building and office number Information on courses taught. Information on office hour sessions. Information on miscellaneous appointments and meetings. +Faculty() +//mutator and accessor methods +getCalendar() : String +toString():String Set defaults and instantiate the ArrayList See "Handling ArrayList" See note below. Use same format as the input file TimeBlock -day:DaysOfWeek startTime:int -endTime:int -comments:String -location:String +TimeBlock( +//mutator and accessor methods +getFormatedTimeBlock(): String +toString():String Day of time block Start time of block End time of block Comments about the time block. Location where the time block is spent Set defaults See Comment below. Use same format as the input file

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

Students also viewed these Databases questions