Mapqwest Program
A cheap, dime-store
imitation of a much better program
Overview: In this
program, you will ask the user for their current location and their
destination. Both points are
represented by an ordered pair location on the screen (row, column). The program will give the user “directions”
on how to get from their location to the destination and show a map on the
screen.
Specifics:
- Use top down programming. Divide the program into small, logical
tasks. Your first two subroutines
should be a title screen and a purpose/directions screen.
- Your third subroutine should ask the user to
enter their location row and column as well as the destination
row and column. Use data
validation loops to ensure that row numbers range between 1-24 and column
numbers range between 1-79.
- Another subroutine should find distances. For instance, if I start in row 14 and
I’m going to row 21, I would be 7 units away. If I start in column 18 and I’m going to column 70, I would
be 52 units away. If I can’t
travel diagonally, then I would have to travel 59 total units to get from
(14, 18) to (21, 70).
- You should have a subroutine that prints
“driving” directions on the screen.
Think of your screen as a map with North, South, East, and
West. Your directions should read
something like this:
Starting Point: (14, 18)
Destination: (21, 70)
Directions:
Start by traveling south
for 7 unit(s)
Turn east and travel 52
unit(s)
Total Distance = 59
unit(s)
At
the end of this subroutine, have the user press m to see a map. (Allow for upper case or lower case). If they press m, the mapping subroutine is
called.
- In the mapping subroutine, the starting point
shows on the screen as the letter “S” and the destination shows as the
letter “D”.
- At the end of the program, ask the user if they
would like to map another travel.
Use their yes/no answer to loop the entire program again if they
wish.