java program

Stewart Litt stewartlitt@hotmail.com
Wed, 27 Feb 2002 01:25:19 +0000


dear sir/madam
iam contacting you regarding a java problem which i have come
across. My teacher at manchester met has set a problem for
us to solve but thinking his teaching is excellent and everyone understands 
him wen no one does I would appreciate you helping me in this problem as it 
would save us from embarrassment.
THE PROBLEM:
Consider a simplified plan of the liverpool bus system. The system consists 
of a network
of bus stops(at most 20) and bus lines (at most 5). Each bus stop has a 
unique name and each busline has a unique number. Each bus stop is connected 
to other bus stops by at most 3 different bus lines. Each of these bus lines 
connects a bus stop to exactly one other bus stop and for each bus stop and 
each connecting bus line it is known how many minutes the bus needs to get 
to the next bus stop.

The objectives are to design and implement in java:

1. A representation of the bus system using suitable data structures.
2. A mechanism to go from one bus stop to a conected bus stop via a 
particular bus line.
3. A mechanism for searching for a connection between two given bus stops.

A command line text based interface should be provided that will allow the 
user to issue a
series of the following five commands:

start: Allows to enter the current bus stop by name and resets the total 
journey time to                                                              
               zero.
list: The system will show the total journey time so far, and all 
information on the current bus stop, that is, its name and the numbers of 
all outgoing bus lines.
go: The system asks for the number of a busline. If the number is that of an 
outgoing
busline, then the system finds out the busstop connected to the current bus 
stop and makes it the new current bus stop. If the number is not that of an 
outgoing bus line, then the system will indicate this by a message , but 
make no other changes.
search: The system asks for the name of a bus stop. The system will then 
indicate whether there is a way to get to this bus stop from the current bus 
stop, but makes no other changes.
exit: Stops and exits the system.

Description of the liverpool bus stop below.

THE LIVERPOOL BUS SYSTEM
Bus Stop      Outgoing bus line       Connected bus stop    Time in mins
Bootle strand	22	              South road            11
Pier head	10	              Shiel road            14
                22                    Bootle strand          7
                79                    Edge hill	            11
Edge hill	79	              Picton clock	    10
Green lane 	10	              Page moss             13
                22                    Bootle strand	    18
Page moss	10	              Prescot	             8
Picton clock	79                    Netherly	            21
Shiel road	10	              Green lane 	     5
South road	22	              Green lane	     9



_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.