Work on this with your assigned partner. Take turns programming and error catching. Turn in one copy, with both names on it.
Documentation
The first thing in your program should be
documentation, just like with homework 1.
Objectives
Introduction
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.
Assignment
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.
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.