CS2134_HW2

CS2134_HW2 - HW#02 Due Tues Oct 2, 11:59 p.m. Hand in using...

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

View Full Document Right Arrow Icon
HW#02 Due Tues Oct 2, 11:59 p.m. Hand in using the digital drop box. PROGRAMMING PART: In this homework problem you'll write a program to manipulate a very simple information system for storing, accessing, and modifying member information for a social club. For each club member, there will be a Person object, storing relevant information about the person such as first name, last name, phone number, and e-mail address. Each person will have a unique ID number. You'll use a vector to store the Person objects and will use function objects to sort and search the vector in various different ways. Your program will read in data about members of the club from a file called "members.txt", then will prompt the user to update the data about the members. After all the updates have been done it will output (to files) the updated data two times, once sorted by ID, and once sorted by (last name , first name). File members.txt will have one entry for each person, consisting of 1. ID-number (an integer between 10000 and 99999 ), 2. last name (a string -- no blanks, any characters are OK), 3. first name (a string -- no blanks, any characters are OK), 4. phone number ( a string consisting of 10 digits). 5. e-mail address (a string ) White space (one or more blanks, tabs, or newlines) will separate the elements of each person. You may assume that there are no errors in this input file. Sample input:
Background image of page 1

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

View Full DocumentRight Arrow Icon
12345 Frankl Phyllis 7182603870 pfrankl@poly.edu 54321 Smith Jane 2121234567 jsmith@gmail.com The program will work in three phases. In the first phase (batch input phase), it will read the data from members.txt and store it in a vector. You may assume that there are no errors in the members.txt file. In the second phase (interactive input phase), the program will prompt the user to update information about members. In the third phase (batch output) the program will output the updated information to files members.byID.txt and members.byName.txt , sorted by ID and by name, respectively. More details follow. Interactive Phase: Throughout the interactive phase, the program will maintain a variable that indicates the location in the vector of the person who is currently logged in, if any. The rest of this problem specification assumes that the variable is called currentIndex and that it is an integer (or size_t). Alternatively, you may use a vector<Person>::iterator currentIterator. Initially, currentIndex or currentIterator should have a default value that is out of range. The program will then repeatedly prompt the user to take any one of the following actions: 1. login 2. change phone number 3. logout Or to enter zero to quit. Option 1 prompts the user to enter her ID or ‘0’ if she does not remember her ID.
Background image of page 2
Normally, the user will enter an ID that is valid (in the correct range) and that corresponds to a Person stored in the vector. The program will set currentIndex to the corresponding index in the vector and output “login successful” to the terminal. If the ID
Background image of page 3

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

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 11

CS2134_HW2 - HW#02 Due Tues Oct 2, 11:59 p.m. Hand in using...

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

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