< previous page page_795 next page >

Page 795
enter the entries in alphabetical order, or enter them in any order and then sort them. Because some last names have changed over the years and you have not bothered to copy them on the appropriate page, it is easier to let the program sort them rather than to enter them in alphabetical order.
Data Structures: To be determined.
Main                    Level 0
Open friendFile for output (and verify success)
WHILE more entries
  Get entry
  Insert entry in alphabetical order
Write entries to file friendFile

Before we can write the Get Entry module, we have to decide what information we want to keep on each person. Because we use this address book mainly to look up telephone numbers, we need each person's name and phone number. We skip addresses in this case study, but include birth dates.
Get Entry (parameters to be determined)                    Level 1
Get name
Get phone number
Get birth date

Write Entries (parameters to be determined)
FOR each entry
  Write firstName, lastName to friendFile
  Write areaCode, phoneNumberto friendFile
  Write month, day, year to friendFile

Get Name (parameters to be determined)                    Level 2
Read firstName
Read lastName

 
< previous page page_795 next page >