Logic Programming
What
versus
How
 

Assignment - Schedule


A school offers a small selection of courses - cs151, cs157, and cs161. It has three rooms in which to offer the courses (g100, g200, and g300). And there are three time periods during which the courses can meet (morning, afternoon, evening). The school administrator wants a worksheet with a table that shows the courses and the rooms and times to which they are assigned; and, on the same sheet, he wants a separate table that shows rooms on one axis and times on another with courses as entries in the table. For planning purposes, he would like the rooms and times in the first table to be drop-down lists so that he can modify them there. He would also like the courses in the second table to be on drop-down lists so that he can modify them that way as well. See below.

Obviously, if he changes the data on one table, he would like the other table to update accordingly. Your job is to create a suitable worksheet and write a dynamic logic program to ensure that the updates happen appropriately. Some updates are easy. For example, if a course is already listed in the second table and the administrator selects that course in a new room or time, the old listing should be deleted and the values in the first table should change. However, sometimes things are not so simple. For example, the administrator may change the room in the first table with the idea of changing the time as well but meantime he has temporarily scheduled the course in the same room at the same time as another course. Your program should handle such situations gracefully. And the approach taken in your program should scale reasonably as the school adds courses and rooms and time periods.

Suggestion: To facilitate your work, copy the worksheet at the URL shown below and save it on your local machine. Using your favorite text editor, add your rules to the file. View the resulting file in your browser to see if it behaves as described above. (If your file is stored in directory "mydirectory" and is named "myfile.html", you can access it by typing the URL "file:///mydirectory/myfile.html" in your browser's address bar.)

Schedule

Note that this assignment is trickier than it sounds. Some of the functionality is easy, but getting it to behave correctly is a bit challenging.

Submission Details. When you are done with the assignment, submit your updated HTML. We will evaluate your worksheet based on the quality of your rules and the behavior of your worksheet.