The Problem

You are to adapt the code that you developed in Assignment 3 to produce an interface that reads the myContactsList.db file and displays it and allows for a number of actions.

The record that you wrote to myContactsList.db has the following structure:

struct contact {
unsigned long phone_number;
long first_name_posn;
long last_name_posn;
long company_name_posn;
long email_posn;
long next;
};

Changes to the original Assignment 3 code:

  • You must enter either a Last Name or a Company Name for each contact (as well as the phone number and email).
  • You must check that the phone number has either 7 or 10 digits.
  • The email address must have the following format: string@string.ccc

Your interface will allow the following to be done:

1. List all contacts in alphabetical (ascending) order by name (either last name or company name) only displaying the name. Only 5 names will be displayed at a time. You can tell the interface to scroll down or up one name at a time.

2. Add a new contact.

3. Allow one of the contacts to be selected (by the number beside it on the display).

4. Display the full information for the selected contact.

5. Change the phone number or email for a selected contact.

6. Delete a selected contact.

7. Return to the full contacts list.

8. Exit the program (all changes to the myContactsList.db file must be written to disk).

Interface

The full contacts list interface is as follows:

Number of Contacts = 20
A
1. Aberfoyle Mill
2. Air Canada
3. Jason Argonaut
B
4. Terry Bernard
5. Bombay Café

The action inputs are the following:

+ Move down one name
-­ Move up one name
Number Select this contact and display its full information
A Add a new contact
X Exit the program

The following pages will introduce the three different interfaces

1. Full Contacts List

2. Contact Information Display

3. Contact Information Edit and Add

Full Contacts List

Number of Contacts = 20
A
1. Aberfoyle Mill
2. Air Canada
3. Jason Argonaut
B
4. Terry Bernard
5. Bombay Café
Action: +
Number of Contacts = 20
A
2. Air Canada
3. Jason Argonaut
B
4. Terry Bernard
5. Bombay Café
6. Ivy Breezie
Action: +
Number of Contacts = 20
A
3. Jason Argonaut
B
4. Terry Bernard
5. Bombay Café
6. Ivy Breezie
C
7. Barbara Catena
Action: -
Number of Contacts = 20
A
2. Air Canada
3. Jason Argonaut
B
4. Terry Bernard
5. Bombay Café
6. Ivy Breezie
Action: 5

Contact Information Display

Contact #5
First Name:
Last Name:
Company Name: Bombay Cafe
Phone Number: 5198373899
Email: bcafe@gmail.com
Action: E
R Return to the Full Contacts List interface
E Edit this contact
D Delete this contact and return to Full Contacts List

Contact Information Edit and Add

Contact #5
First Name:
Last Name:
Company Name: Bombay Cafe
Phone Number (enter only numbers): 5198362788
Email: bombaycafe@gmail.com
Action: S
Number of Contacts = 20
A
2. Air Canada
3. Jason Argonaut
B
4. Terry Bernard
5. Bombay Café
6. Ivy Breezie
Action: A
Contact #8
First Name: Peg
Last Name: Balasheta
Company Name:
Phone Number (enter only numbers): 6733860
Email: peg@balasheta.org
Action: S
Number of Contacts = 21
A
2. Air Canada
3. Jason Argonaut
B
4. Peg Balashata
5. Terry Bernardo
6. Bombay Cafe
Action: X
R Return to the Full Contacts List interface
(do not update contact record)
S Save this contact and return to Full
Contacts List
D Delete this contact and return to Full
Contacts List
R Return to the Full Contacts List interface
(do not update contact record)
S Save this contact and return to Full
Contacts List
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.