ScheduledTime
, Event
and
Schedule
classes.
VSDriver
class that has
all of the String
"constants"
you'll need for the application (e.g., for prompts and error messages),
and an empty method with the signature
public static void main(String[] args)
.
main()
method that: calls the
ScheduledTime
class's setTruncationValue()
method passing it the value 5
, declares and constructs a
Schedule
object, and adds several hard-coded
Event
objects to it. (It's a good idea to try and
construct some Event
objects with invalid days or times
to see what happens.)
private static void displayEvents(Schedule schedule)
that
outputs the given Schedule
object in the appropriate format.
Modify the main()
method so that it calls the
displayEvents()
method both before and after the
Event
objects are added to the Schedule
object.
private static boolean addEvent(Event event, Schedule schedule)
that adds the given Event
to the given Schedule
object
only if it does not conflict with (i.e., overlap) an Event
that is in the Schedule
. This method should return
true
if the Event
was added and false
otherwise. Modify the main()
method so that it uses the
addEvent()
method.
private static Event createEvent(String s)
that parses the given String
representation of an
Event
, constructs a corresponding Event
object, and returns it. If the String
representation
can't be parsed, this method should output the appropriate error
message and return null
. Modify the main()
method so that it uses the createEvent()
method.
main()
method so that the application
provides the required functionality.
main()
method and add
methods that eliminate the duplication.
Copyright 2011