Lab 14 - Friends File
For this project you will modify Lab 13 to insert new friends in the arrays so
that the arrays are maintained in alphabetic order by last name. Since your
current file is not in order by last name you will need to delete the existing
file and begin with a new file. It may be a good idea to create a file in
Notepad with a few friend records in the appropriate order.
The code to maintain the order of the friends will be added to the Add Friend
logic.
When a new friend is added you will
-
Look through the array and determine the correct position within the
array.
-
Move all the friend data that should follow the new friend "down" in the
array. (for example: If you determine the new friend "Harris" should be
added in position 5 (between "Franklin" and "Jackson") you must move
Jackson from position 5 to position 6. You will of course have to move ALL
the friends that follow "Harris" to a new array location.
-
Remember you will need to move ALL the friend information.
Form Load
Unique numbers will continue to be assigned to each new friend but because the
friend records will be stored in alphabetic order the records will no longer be
in key field value order.
To determine the next available key field value save the largest key field value
read from the file. The first new friend will be assigned a key field value 1
larger than the largest already assigned to a friend.
Because the arrays will be maintained in order the file will also be in the
correct order when you save it to permanent storage.