hw06-fall09 - HW#06 Due 11:59 p.m. Mon. Dec. 7 PROGRAMMING...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
HW#06 Due 11:59 p.m. Mon. Dec. 7 PROGRAMMING PART: In this homework problem you'll again work with the geographic data from HW2, but this time, you’ll store it in an STL map. The input file is the same as in HW2. The program will work in two phases: a batch input phase, in which the data is input from a file and stored in an STL map; and an interactive phase, in which the user can choose options from a menu in order to access, query, and update the data. Batch Input Phase: The batch input phase will read an input file named gnf_in.txt, which has the same format as the input file in HW2. The information about the GNFs will be stored in the map, with the sort-name used as the key. The sort-name is a string, without spaces, associated with a GNF. For this assignment, we will use sort-names, rather than UFIs, to identify GNFs. Although the input file in HW2 contained some instances of sort-names that were associated with more than one GNF (e.g. MORTON), in this assignment we will only store one GNF per sort-name. If the sort-name occurs more than once in the input file, only the GNF associated with the first occurrence of the sort-name in the input file will be placed in the map. All subsequent GNFs having the same sort-name will be ignored. (We are using sort-names rather than UFI’s as identifiers in this assignment simply because it is easier to read and type a name rather than a number.) All information other than the sort-name will be stored in a GNF1 object. A GNF1 object is the same as a GNF object (as described in HW2), except that it does not have the sort-name data member. The type of the map will be map<string,GNF1>. At the end of the batch input phase, the size of the map should be the number of lines in the input file. Interactive Phase: In the interactive phase, the program will repeatedly prompt the user to take any one of the following actions: 1. find GNF by sort-name 2. compute the distance in kilometers between two GNFs, given by sort-names 3. read and process a file of updates 4. test or to enter zero to quit.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Option 1 prompts the user to enter the sort-name of a GNF. It displays the sort-name, ufi,
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/02/2011 for the course CS 2134 taught by Professor Hellerstein during the Fall '07 term at NYU Poly.

Page1 / 4

hw06-fall09 - HW#06 Due 11:59 p.m. Mon. Dec. 7 PROGRAMMING...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online