Project 5

Introduction

For this project we are going to be extending our basic address and address book classes to be a little more functional. We will be exploring the uses of arrays as a storage unit and their limitations. Specifically, we are going to be learning how to move elements around within the array to make space for new element and how to "remove" elements by sliding down.

Details

The details for the project are in the Project 5 API and you should be sure to read them closely to make sure you know what you need to do.

Sliding Up

The basic algorithm for sliding up to make a space at a given location are as follows:

Go to one past the last location within the array where data is stored
Move the element that is one lower in index into the position where you are
Stop when you reach the desired location.

Sliding Down

The basic algorithm for sliding down to remove an element at a given location are as follows:

Go to the location where you want to remove the element
For every element but the last one, move the element that is next down to where you are
Stop when you are 1 away from the last element in the array

Changes from Project 4

The biggest change is in how we are storing the data. So no longer are we using a fixed sized static array. Instead we are using a dynamically allocated array using a pointer. Also, instead of returning the default address in removeAddressAt and addressAt, if the location is "bad", then we are throwing an outofbounds exception.

Helpful Files

If you were unsuccessful on Project 4, please email me and I can give you some basic P4 code to get you started.

Input

There really is no input format for this project. You should write a main that will make an address book and add some address, remove some address, etc. to test the functionality.

Output

This is a sample output for what display address would look like for 3 made up addresses.

First                Last             Address            Birthday
A                   A                 AAA   01/01/2014
B                   B                 BBB   01/01/2014
C                   C                 CCC   01/01/2014

You do not need to match the spacing within a line. You need at least 1 space between each column of output.

Requirements

  1. You must use some way of making a "hole" to store the address for insertion, i.e. you may not just put the address at the end and then sort the array
  2. The size of your array must be 10 to start.
  3. When you "grow" your array you must double it.
  4. You must use some way of "covering" the address on removal.
  5. The array must always be stored in sorted order.
  6. You must comment your classes with a header comment and methods with method comments

Optional Approach

If you are looking for a slightly more advanced approach to solving this problem. Implement the Vector and then instead of having the dynamic array plain in the AddressBook, use the Vector instead. If you choose to go this route, then you must typedef your Vector to use Address as the storage type.

Due

This is due May 6 by 11:55PM

Grading

Zip up your Date.h, Date.cpp, Address.h, Address.cpp, AddressBook.h and AddressBook.cpp and turn them into Web-CAT