CSc 3610 Programming Assignment #2

Work on this with your assigned partner. Take turns programming and error catching. Turn in one copy, with both names on it.

The first thing in your program should be documentation, just like with homework 1.


  1. Practice pair programming.
  2. Practice designing a program.
  3. Practice implementing a program design in MATLAB.
  4. Practice testing a program.
  5. To get familiar with matrices.

Suppose that you want to travel to several different cities, to sell your latest MATLAB program. Obviously, you want the trip to be as cheap as possible, and do not really care what order you visit the cities. You start in Atlanta, travel from city to city, and finally return to Atlanta. Of course, whatever your destination for flight 1 will be the source for flight 2. For example, you might fly from Atlanta to Boston, Boston to Dallas, Dallas to Chicago, then Chicago to Atlanta.

Your program should use a matrix to store the flight information. Each row should correspond to one source city, and each column represent the price to fly to the destination city. (We will assume for simplicity that the cost to fly is the same regardless of the direction, i.e. a flight from Dallas to Chicago costs the same as a flight from Chicago to Dallas.) Your program should report a flight itinerary, indicating flight number, source city, and destination, such as: "flight 1 from Atlanta to Chicago $50.00". At the end, display the total amount.

Use this data:
Atlanta Boston Chicago Dallas Evansville Flagstaff Green Bay Houston Indianapolis Jacksonville
Atlanta - 193 192 185 172 164 205 215 190 314
Boston - 173 187 194 223 202 194 360 417
Chicago - 312 350 348 299 372 365 399
Dallas - 270 219 265 234 267 495
Evansville - 210 201 214 288 389
Flagstaff - 317 889 400 467
Green Bay - 220 305 512
Houston - 299 599
Indianapolis - 295
Jacksonville -

You only have to solve this problem for the cities Atlanta, Boston, Chicago, Dallas, and Evansville, to receive full credit.

To solve your problem, write a program that reads the necessary information to compute and output the indicated values, as efficiently as possible. Design your program by specifying its behavior, identifying the variables and operations it needs to solve the problem, and then organizing the variables and operations into an algorithm. Then code your design in MATLAB using stepwise translation. Finally, test your program thoroughly.

Turn In Electronic copies of your files to the TA.

Turn In Hard copies of:
  1. your design (behavior, variables, operations, algorithm)
  2. your source code
  3. the output from your program (using a script*).
  4. a copy of your e-mail to the TA
The printouts of the above must be handed in during class. To be considered "on-time", you must turn in all of the above on-time. Make sure that your printouts use a monospaced font.

Due date: October 19, 2006

* A script is short for typescript, where everything typed is saved. This keeps a log of all the input and output. MATLAB provides this capability with the diary command. For example, diary out records all inputs and outputs in a file named ``out''. Type help diary at the MATLAB prompt for more information.