In this assignment, you will demonstrate what you have learned with respect to

  • Using structs, pointers and arrays
  • Using multiple .c source files, header file and makefile
  • Input validation and proper error message
  • Implement proper testing

Sample output may look like:

Choose one of the five following options:
Press [1] to get information based on phone number:
Press [2] to get information based on Area Code:
Press [3] to ge t information based on Last Name:
Press [4] to print all area - code information:
Press [q] to quit:
1

You pressed: 1
Enter Area Code: 416

Enter 7 - digit number: 2345678

Your 10 - digit phone number was: 416 - 2345678
Phone number: 416 - 2345678 belongs to the S tudent Last1, First1 and his number is from Toronto

Statement of the phone book problem

To start with:

  • you will take user input and
  • create a linked list of 5 Areas as (area code 613 for Ottawa), (416 and 647 for Toronto), (519 for Windsor) and (905 for Niagra Falls).
  • Insert node at the end: You will insert each new area node at the end of the link list.
  • You will print the list of area names and count number of listed areas in the link list each time you insert a new area node. This will show that you are inserting a new area node at the end and you can traverse through the link list and determine the length of the list.
typedef struct Area
{
int areaCode; char
areaName[20];
struct Area *nextArea;
}
Area;
  • Take user input and create a link list of 10 phone book entry with the existing 5 areas o To start with, you will use a list of 10 random phone numbers from Greater Ontario with area codes according to the following struct.
typedef struct PhEntry
{
int areaCode;
int phoneNumber;
char lastName[20];
char firstName[20];
struct PhEntry *next PhEntry;
} PhEntry;
  • Insert node at the beginning: Insert each new PhEntry node at the beginning of the link list.
  • You will print the listed 10 digit phone number and count number of listed PhEntry in the link list each time you insert a new PhEntry node. This will show that you are inserting a new node at the head and you can traverse through the link list and determine the length of the list.
  • You will implement deletion of a selected node from link list for option 4 below.
  • You will implement doubly link for the deletion of a selected node from link list for option 5 below.

When your program will run, it will ask for the following choices:

1) If you choose option 1 you will have to enter 3 digit area code + area description. Insert each area node at the end of the area link list and print as detailed above.

2) If you choose option 2 you have to enter 3 digit area code +7 digit phone number and last name and first name of the person. Insert each PhEntry node at the beginning of the PhEntry link list and print as detailed above.

3) If you choose option 3 you will be able to modify an existing phone book entry based on:

  • 3 digit area code +7 digit phone number or
  • last name of the person

4) If you choose option 4 you will be able to delete an existing phone book entry based on:

  • 3 digit area code +7 digit phone number or
  • last name of the person

5) If you choose option 5, you will be asked to provide o an existing area code or o an Area Description.

  • If the area code exists in any of person's Phone book entry then you will be informed: this area is use and cannot be deleted. Otherwise, you may delete that.
  • If the area description uses multiple area code (Toronto has more than one area code), you have to inform that and ask for which area code
  • You have to implement this using doubly link list

6) Enter 'q' to quit your program.

S ample options may look like:

Choose one of the following options:
Press [1] to Enter Area information:
Press [2] to Enter PhoneBook Entry:
Press [3] to Modify an existing PhoneBook Entry:
Press [4] to Delete an existing PhoneBook Entry:
Press [5] to Delete an unused Area using doubly link list:
Press [q] to quit:
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.