JMU
logo.png
Programming Assignment 2


1 Overview: For programming assignment 1 you had to implement the "main class" for a command-line application named VirtualStudent. For this programming assignment you must implement the classes that were given to you for that assignment.
2 Existing Components: You have the VSDriver class that you developed for programming assignment 1.
3 New Components: You must develop the following classes:

Your implementations must be consistent with all of the documentation describing these classes.

4 Other Requirements: Your Schedule class must use an array of Event objects. It must not use any other kind of collection (e.g., ArrayList, Vector, HashMap, etc...).
5 A Suggested Implementation/Testing Process: As always, you should divide the implementation and testing phase into small pieces and work on one piece at a time. We recommend the following process:
  1. Create a version of the ScheduledTime class that has all of the attributes it needs and all of the methods except the compareTo() method and the single-parameter explicit value constructor. [Hints: (1) You may want to include some private methods. (2) The setTruncationValue() should only store the value it is passed.] Fully test this version.
  2. Add the compareTo() method to the ScheduledTime class. Fully test this version.
  3. Add code to the ScheduledTime class that can be used to parse a String representation of a time. Give careful thought to where this code should be. Fully test this code.
  4. Add the single-parameter explicit value constructor if you have not already done so. Fully test the entire class.
  5. Create a version of the Event class that has all of the attributes it needs and the toString() method. Give careful thought to how to represent the days (there are several options, list them all and evaluate them); use ScheduledTime objects for the start and end times.
  6. Add code to the Event class that can be used to parse a String representation of the days passed to the constructor. (Hint: The String class has a String.startsWith(java.lang.String) java.lang.String#startsWith(java.lang.String) method that might be helpful.) Give careful thought to where this code should be. Fully test this code.
  7. Add code to the Event class that can be used to parse a String representation of the times passed to the constructor. Again, give careful thought to where this code should be. Also, make sure you do not duplicate code that is in the ScheduledTime class.
  8. Add the three-parameter explicit value contructor to the Event class. Fully test this version of the class.
  9. Add the conflicts() method to the Event class. (Hint: On paper, create a time-line and, using an interval to denote the start and end times of an Event, figure out when Event objects conflict.) Fully test the class.
  10. Create a version of the Schedule class that has all of the attributes it needs and the explicit value constructor.
  11. Add the add() method to the Schedule class. Fully test this version of the class.
  12. Add the remaining methods to the Schedule class. Fully test the class.

Copyright 2013