First Assignment, due 7th February 2002

Electronic Submission, hw1

 

Using the sample customer information list (available on rabbit as the file ~data/people), write a C++ program that first reads in the entire contents of the file (as discussed in class), then interacts with the user, offering a menu of choices:

 

1:         Search for a person by name. The user is invited to enter the person's last name, and the program prints out all the details of that person if he/she/it exists.

 

2:         Search for a person by telephone number. Same as number 1, but user enters telephone number instead of name.

 

3:         Search for people by zip-code. User enters zip code, program prints list of all people living in that area.

 

4:         Count number of people living in a particular state. User enters two-letter state abbreviation, program prints just the number of people living in that state.

 

Plus, find out how long it takes your program to perform some of those operations:

 

5:         Time the search-by-name operation. Exactly the same as option 1, but the program also reports how long the search took.

            a.            How long does it take to find customer Aikei?

            b.            How long does it take to find customer Kelpiann?

            c.            Why the difference?

 

6.         Time the count-by-state operation. Exactly the same as option 4, but the program also reports how long the search took.

 

7.         Exit program. The program should run in a loop accepting unlimited queries from the user, until option 7 is selected.