#include <AddressBook.h>
Public Member Functions | |
AddressBook () | |
Address | addressAt (int location) const |
void | addAddress (Address a) |
Address | removeAddressAt (int location) |
void | displayAddresses (std::ostream &out) const |
Private Member Functions | |
void | slideUp (int loc) |
void | slideDown (int loc) |
Private Attributes | |
Address | theBook [10] |
int | size |
This class will have an array of Addresses of size 10. It will store addresses and return them.
AddressBook::AddressBook | ( | ) |
This is the constructor. It needs to initialize theBook and the size
void AddressBook::addAddress | ( | Address | a | ) |
This will add the given address to the book at the location according to the address's last name. We will insert them in ascending, i.e. A-Z, order
a | - The Address you want added to the end of the address book. |
Address AddressBook::addressAt | ( | int | location | ) | const |
This will return the address at the given location. If the location is bad, then the address that is returned is the default address, i.e. Address();
location | - the location in the address book that you want returned. |
void AddressBook::displayAddresses | ( | std::ostream & | out | ) | const |
This will simply display the address in the book to the ostream that is given. Start your display with a header that says: Then on the next line display "First Last Address Birthday" then the first name and last name of the address then comes the address and last on the line is the birthday displayed as MM/DD/YYYY. Repeat for the rest of the addresses.
out | - the ostream to use for displaying the addresses |
Address AddressBook::removeAddressAt | ( | int | location | ) |
This will remove the address from the address book at the given location. If the location is bad, then the address that is returned is the default address. Otherwise, this will remove and return the address at the given location.
location | - the location in the address book that you want returned. |