CS2134_HW3

CS2134_HW3 - HOMEWORK #3 PROGRAMMING PART (Written part...

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

View Full Document Right Arrow Icon
HOMEWORK #3 PROGRAMMING PART (Written part will be posted soon.) CS2134, Fall 07 Due 11:59 p.m. Thurs. Oct 11 Hand it in in a single file called hw03.cpp or a zip called hw03.zip, via the Digital Drop Box. In this assignment you'll modify the program from HW #2, adding some features and changing it so the data is stored in an STL map, rather than a vector. You should use STL iterators and algorithms as much as possible and should choose operations that do their work efficiently. Problem Specification: As in HW#2, your program will have three phases, 1. A “batch input” phase where it inputs data about some club members from a file, named members.txt and inserts each item into a container. In HW#2 the container was a vector. In HW#3, the container is a map. The file format of members.txt is the same as in HW#2. 2. An “interactive” phase where the user enters updates to the data. In addition to the options in HW#2, the user can choose from among some other options, as described below. 3. An output phase, where the updated output is written to a file. In HW#3 the program will only write output to one file, membersByID.txt, sorted by ID. Changes to the interactive phase: In HW#2 you could choose to use either a vector index (currentIndex) or an (vector:: ) iterator (currentIterator) to point to the Object representing the member who is currently logged in. In HW#3, you should use an (map:: )iterator for this task. In addition to the previous menu options, the user can perform some other functions. The interaction with the user should be done through a simple menu driven interface, where the program prompts the user to choose a type of update, then prompts for appropriate parameters. The new options are: 4. Add member: The program prompts the user to enter the ID number, last name, first name, phone number, and e-mail address of a new club member. Normally, the program inserts the new member into the map and outputs a “member added” message to the terminal. If any of the data is not valid or if there is already a member with this ID number, the program outputs a warning message and does update the map.
Background image of page 1

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

View Full DocumentRight Arrow Icon
5. Remove member: The program prompts the user to enter the ID number of a member. Normally, the program removes (erases) the member from the map and outputs a “member removed” message to the terminal. If there are problems with the input data, or no member with that ID, the program outputs an appropriate warning message and does not update the map. 6. Find ID: user enters last name and first name. The program returns the ID number for that person (or indication that no such person is in the club.) Notes: 1. Searching for an ID number, adding a member to the map, and removing a member should be done in O(log n) time, where n is the number of members in the club. 2.
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 05/18/2008 for the course CS 2134 taught by Professor Hellerstein during the Fall '07 term at NYU Poly.

Page1 / 10

CS2134_HW3 - HOMEWORK #3 PROGRAMMING PART (Written part...

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