600.120 Intermediate Programming
Spring 2010 -- Assignment 5
Due 4/1 by 2:45pm
45 points total
Specifications:
- Readings: C++ text Chapters 1-6, Appendix A
- Compilation: g++ -std=c++98 -ansi -pedantic -Wall -Wextra -O
- Collaboration: This is an individual programming assignment.
- Submission: You are expected to use several files to organize your
solution. Create a makefile for compilation, and use tar/gzip to
collect all the program files you are submitting (all *.h, *.cpp and
your makefile) into one compressed file. Submit this on webCT.
Bring a printout of your *.cpp files only (not *.h files) to class
to facilitate grading.
- Grading: 45 points total = 40 functionality + 5
style/submission/efficiency.
-5 points if there are any warnings using the required compilation options. 0
points if the files don't all compile together (ie, any file has errors, no
executable created). Continue to use good incremental coding
development and ruthless testing!!
The Problem:
For this assignment you will use the C++ STL to maintain a
collection of phone numbers, such as may be found in your cell
phone. Your collection will consist of multiple contacts. Each
contact has a name and a list of phone number pairs. Each phone
number pair consists of the type of number (for example, "CELL",
"HOME", "WORK", "FAX", etc.) and the actual phone number.
The basic operation will allow the user to add/edit/delete a
contact, add/edit/delete a number for a contact, add/delete contacts
from a favorites collection, and rearrange the position of a contact
in the favorites list. You should also have options to display all
the contacts in alphabetical order, display all the numbers for a
particular contact, and display the names of all the favorites, in
the order in which you have put them (and rearranged them) in the
favorites list.
All data should be input from the keyboard. All output should go
to the screen. Make your program interactive and reasonably user
friendly. The exact user interface is up to you. Consider using
layers of menus instead of one huge menu with options for
everything. (Can you use the STL to store common menu operations?)
Implementation Requirements:
- Use the STL for most of the data storage and
processing (string, vector, list).
- Define structs and typedefs to organize the various data types. Add
functions for basic operations, such as reading and writing (see
Card.h and Card.cpp for examples).
- Do not replicate data in the favorites collection.
Instead make the items in favorites be some type of reference to the
actual contact data.
- Use the most appropriate data types and algorithms for the best
efficiency possible.
- Use const to protect data as much as possible.
- You can only use specific "using" statements, not "using namespace
std".