Winter 2005 UCLA CS 31 (Shinnerl)
Programming Project 4: Bus Schedule Generator
DUE: Wed. 2/9/2005
FINAL Specification 9:50PM, 1/27
Implement a C++ program
to generate a table of arrival times for buses at a sequence of bus
stops along a bus route. The general layout of the schedule should
follow that of the schedules
posted around campus.
Bus stop names are displayed along the top row of the table.
Each subsequent row lists the
arrival times of a single bus traveling along the route.
At start up, the program requests and reads in the following
data from the user.
-
The names of the bus stops (character strings) in the order
in which the bus visits them. For this assignment, you may assume
each route lists times for exactly 5 stops along the route.
-
The time of arrival of the first bus at the first stop.
Times are listed in the format HH:MM [ap]m, where
HH is the hour (1 <= HH <= 12),
MM is the minutes (00 <= MM <= 59), and the correct
suffix am or pm appears after the minutes.
-
The amounts of time it takes a bus to get from each stop listed to
the next one listed --- that's 4 different transit times (see below),
not 5. Assume that
these times include the time needed to stop and allow passengers
to climb in or out. Assume that
once a bus reaches the last stop, it then drives back the same route,
in the reverse direction, to return to the first stop.
You are not asked to print
any times for the return trip, but you will need the assumption that
the return trip from Stop 5 to Stop 1 takes the same amount of time
as the forward trip from Stop 1 to Stop 5 (see below). (The driver
may need to wait a few minutes after arriving at Stop 5
so as not to arrive too early at Stop 1.)
-
The time between arrivals of consecutive buses at the same stop
on the route.
-
A final arrival time at Stop 1 for the last bus traveling the given
route on the current shift.
In addition to printing out the table, your program specifies how many
buses are needed to service the route, and how long each driver should
wait at Stop 5 before departing for the return trip.
Submit a file p4.zip which produces two files when decompressed:
report.xxx and p4.cpp.
Project 4 Home Page