Phone book Program

My assignment is to program a phone book and Im so confused someone please help me!!!
Here are the instructions:

The program starts by reading a test file. If there is an error it must say so. Here is the main menu:
6 lines read.
Please choose one of:
a Add person
d Delete person
p Print
q Quit
r Reset (reread data file)
s Sort
w Write (overwrites data file)

The ‘a’ command looks EXACTLY like this:
a
Adding person...
Please enter first name:
Please enter last name:
Please enter office (NO SPACES):
Please enter phone extension (4 characters):
Person added.
The width of the instructions is 46. Exactly 46. Not bigger than 46. Not smaller than 46. Forty six. This is a
magic number. .
Test the length of the phone extension. It must be 4 digits.

The ‘d’ command looks like this:
d
Please enter a complete first name, last name, office or extension: 6300
Delete Joanne Freitag? (Y or N) N
Delete John Hemenway? (Y or N) Y
1 records deleted.

The ‘p’ command looks like this:
p
First Name Last Name Office Extension
====================================================
Cathy Duffy ad34 5828
David Brunn we65 5883
Joanne Freitag LH415 6390
Julie Dawson Cf224 2307
Victoria Montanaro DSC261 5830

Spacing must exactly match this. There are 12 characters, then 16, then 12 then 12. If you added or deleted people, this print out must show it.

The ‘q’ command quits.

The ‘r’ command rereads the data file. In this way you can test deleting, sorting and adding without having to rerun the program.

The ‘r’ command looks like this:
r
Phonebook reset. Size is: 6

The ‘s’ command introduces a submenu. Sorting must be provided for first name, last name, office and
extension. The ‘s’ command looks like this:
s
Please choose one of:
f Sort by first name
l Sort by last name
e Sort by extension
o Sort by office
o
Sorting complete.

The ‘w’ command saves the phone book back to the data file.

Please help im not sure where to start



Hello randflec,

The first thing I would is decide on what variables I would need. Then I would work on opening the files for input and output followed by some testing to see if they work correctly.

Then I would most likely work on the main menu. Starting with quit and then add.

Of course the first part to work on is to figure out how the program will flow. If you have had the class on flow charting or something on program flow you could work out a flow chart or do some pseudo code.

Hope that helps for a start,

Andy
Topic archived. No new replies allowed.