Question: Programming Exercise Objective: In this assignment, you will demonstrate what you have learned with respect to Using structs, pointers, and arrays Using multiple .c source
Programming Exercise Objective:
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 make file
Input validation and proper error message Code
CODE A:Statement of the phone book problem:
Build a small phone book program
To start with, you will use a list of TEN random phone numbers from Greater Ontario with area codes (613 for Ottawa), (416 and 647 for Toronto), (519 for Windsor), and (905 for Niagra Falls). You do not need user input to build the list.
You will represent each phone number by 10 digits.
You will create a list of 5 Areas as mentioned above (e.g., 613, 416..) . You do not need user input to build the list.
Remember what you have learned in Lectures so far?
North American telephone numbers always follow the following structure:
3 - digit area code + 3 - digit central office code + 4 - digit subscriber, For example, the Algonquin College main phone number is (613) 727 - 4723 where the area code is 613, the central office (or exchange) is 727 and the subscriber is 4723.
Neither the area code nor the central office code will ever start with the digit 0\" or 1.
Print your 10 - digit number in the format: (613) 727 - 4723
You will:
Represent each phone entry by a unique 7 - digit phone number (3 - digit central office code + 4 - digit subscriber), 3 - digit Area code, Last Name, and First Name.
Represent each Area with 3 - digit Area code (416) and Area Name (e.g., Toronto). You will create five Areas as mentioned above.
When your program will run it will ask for 5 choices:
1. If you choose option 1 you will have to enter 3 - digit area code +7 - digit phone number to get the details of that student
2. If you choose option 2 you will have to enter 3 - digit area code to get the details of all the students who have phone numbers with that area code.
3. If you choose option 3 you will have to enter the last name of the student to get the details of that student.
4. If you choose option 4 you will get the details of all the listed area codes
5. Enter 'q' to quit your program.
Code B: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 the 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
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.
o Insert node at the beginning: Insert each new PhEntry node at the beginning of the link list.
o You will print the listed 10 digit phone number and count the 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:
o 3 digit area code +7 digit phone number or
o last name of the person
4) If you choose option 4 you will be able to delete an existing phone book entry based on:
o 3 digit area code +7 digit phone number or
o 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.
o If the area code exists in any of persons Phone book entry the n you will be informed: this area is use and cannot be deleted. Otherwise, you may delete that.
o 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
o You have to implement this using doubly link list and
o This a bonus option worth 5 marks.
6) Enter q to quit your program.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
