|I'm new to C++ and i have a project to complete. But i can't seem to come up with the code. I already wrote the code for the cards but i can't come up with the code for the information manager. Can somebody help me?|
This goal of this project is to build an information manager similar to a rolodex (see http://en.wikipedia.org/wiki/Rolodex). A physical rolodex is made up of cards arranged in alphabetical order by [Last Name, First Name]. Each card contains some information, usually name, address, phone number and type of business (why the person is in the rolodex). The physical mechanism of using a rolodex is turning the group of cards and flipping through them. When the last card is read, the rolodex is then at the start of the list since a rolodex is built on a circular track.
Provide the following interactive commands in main() to work with your rolodex:
* list - displays all the cards in the rolodex, in alphabetical order from beginning to end.
* view - displays the card at the current position.
* flip - updates the current position to the next card, and displays it. Flipping past the last card wraps around to the first card.
* search - finds and displays a card, and makes it the current position in the rolodex. This command prompts for the last name for searching. If a matching card is found, it is displayed and is set as the current position. If no matching card is found, the card that immediately follows the lookup name is displayed and set as the current position (e.g. if "H" is entered as the last name, the first card with a last name following "H" in alphabetical order is displayed). If there is no following card, displays "Couldn't find: name"
* add - adds a new card to the rolodex. Prompts for each field value, reads it, and enters the new card in the correct position in the rolodex (based on alphabetical order). The new card is set as the current position.
* remove - removes the card at the current position. It displays the card and prompts for a confirmation for removal. The following card is set as the current position.
* modify - updates the card at the current position. Enters a mode that requests the field to be updated (e.g. phone #), displays the existing value and prompts for the new value, reads it, and updates the card. Continues prompting for additional changes until all changes are done (e.g. a 0 is entered for the field # to change). If the last name is changed, the card must be moved to the correct position in the rolodex (and is set as the current position).
* quit - exits the program.
Use the following information to provide the initial information to demonstrate the functionality of your rolodex program. You can hardcode these entries into your rolodex initialization in main() to simulate reading the information from a file..
The Standard Library std::string class should be used for the character information (no char* or char arrays).
Individual cards should be represented by objects of a user defined class (e.g. Card or RoloCard). Member functions of this class should allow getting and setting of data values (e.g. first name), and possibly a display function that knows how to display the card on the supplied ostream parameter. This class does not know about Rolodex functionality, it just encapsulates a single card's information.
A Rolodex class should use an STL container class as a data member to hold the set of rolodex cards, and associated iterator to reference the current card. The container used must be able to handle the case of duplicate names (e.g. two of Jim Smith, etc). The member functions of this class manage the collection of cards, and may have parameters or return values that are a Card object. For example:
* The add() member function should have a Card parameter, so that the main() code adding a card first does the interaction with the user to get the info for the new card, constructs the Card object, and then finally calls the Rolodex.add() method, passing the Card object to be added to the rolodex. The Rolodex.add() method shouldn't do all the interaction with the user or create the Card (that's done by the caller). It just adds its parameter Card object to the Rolodex collection of cards (in the correct position), and updates its iterator to refer to the new card as the current position.
* The list() member function should use a local iterator to iterate through the collection of cards and display them. It can have an ostream parameter that the output should be displayed to, and can call each card's display member function for the output. It doesn't know how to display the card's data, rather, it requests each card to display its data on the provided ostream parameter.
* A modify can be done by the code in main() getting the current card, performing the interactions to modify its value(s), and then if the modify is approved by the user, call the Rolodex.remove() function to remove the (old) card from the collection, and then Rolodex.add() to add the modified card to the collection. Here again, the Rolodex class knows nothing about how to modify the contents of a card. Most of the work is done in the main() function that interacts with the user, and then the Rolodex functions are used to simply remove the old card and add back the modified card (which may have a changed last name, so it would be added back at a different position in the collection).