经典案例 > Java代写 >

Homework 4 Programming

(Maximum 25 points; extra credit after the first two programming exercises) Due 11:59 pm Wednesday February 20, 2019


Submit your Java codes via Blackboard. Refer to the grading guidelines posted on Blackboard to understand how the submitted exercises will be graded.


1. (25: optional after two required) [Interval partitioning: programming] Implement the interval partitioning algorithm discussed in class. Your program should prompt the name of an input file containing a list of lectures (i.e., lecture number, start time, end time) and read from the file and then output (1) during the program run, the room number and the start time and end time of the lecture allocated to the room and (2) at the end of the program run, the list of all lectures allocated to each room. Example input and output are shown below. (The input is also provided in a text file “lectures1.txt”.) Feel free to use Java priority queue class or write your own. Submit all source codes as one program file. Your program codes should be working correctly and neatly organized and well commented.

Input in lectures1.txt (One lecture entry per line; entry format: (lecture number, start time, end time))

(a, 1, 5)

(b, 4, 8)

(c, 2, 4)

Output for lectures in lectures1.txt (Two rooms are allocated for the three lectures.)

During the program run: Room 1: (a, 1, 5)

Room 2: (c, 2, 4)

Room 2: (b, 4, 8)

At the end of the program run: Room 1: (a, 1, 5)

Room 2: (c, 2, 4) (b, 4, 8)


Last modified: February 7, 2019

51作业君 51作业君

扫码添加客服微信

点击跳转淘宝店