CS 127: Data Structures

Rolodex Information Management

Assigned on Monday, 1/21/02.
Design document due on paper at the beginning of class on Wednesday, 1/23/02.
Final program due electronically on Monday, 1/28/02 at 5 PM.

Overview

Congratulations! You've graduated from Carleton, travelled around the world at least thrice, and now you're developing software for the new (or not so new) electronic Rolodex. A traditional Rolodex is a circular address book, as shown in the picture below.

For this assignment, you will not be turning in a complete program. You will build a class called Rolodex, which contains appropriate public methods for operating on an electronic Rolodex.

To say it differently: The code that you turn in should not have the word "main" in it anywhere.

Specifications

Each Rolodex "card" should contain a last name and a phone number. For simplicity, we will require that no two people have the same last name. Internally, you should keep track of the "current card" - this is the card which is currently "flipped open" on the Rolodex. Your Rolodex class should have the following public methods:
 
Method Description
bool Rolodex::insert_card(string last_name, string phone); Insert the person into the Rolodex, immediately after the current card. Change the current card pointer to refer to this new card. If the Rolodex is full, return false; otherwise, return true.
bool Rolodex::get_current_name(string &last_name); Provide the last name on the current card. If no current card has been set by the user, return false; otherwise, return true.
bool Rolodex::get_current_phone(string &phone); Provide the phone number on the current card. If no current card has been set by the user, return false; otherwise, return true.
bool Rolodex::next_card(); Change the current card pointer to refer to the next card in the Rolodex. If the current card is the last card, the next card should be the first one (this is a circular Rolodex). If there is only one card, the next card is the same card. If there are no cards in the Rolodex, this method should return false; otherwise, return true.
bool Rolodex::delete_current_card(); Delete the current card from the Rolodex, and change the current card pointer to refer to the next card in the Rolodex. If this card is the last card in the Rolodex, no card should be the current card. If no cards were present in the Rolodex, return false; otherwise return true.

Submission Details

You should submit the following files, using the hsp program:

Programming Details

HAVE FUN!