Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Contact.hpp #ifndef Contact_hpp #define Contact_hpp #include using namespace std; // structure to hold the data related to one contact struct Contact { string firstName; string
Contact.hpp
#ifndef Contact_hpp #define Contact_hpp #include using namespace std; // structure to hold the data related to one contact struct Contact { string firstName; string lastName; string tel; }; // This operator is being overloaded so it can be used to print the content of // a variable of type Contact. // Ex: Contact person // coutwith C++
Objective: Implement an application that uses linked lists. To be completed by a group of 3 people. Assignment: This is a group assignment. You can keep the same group that you had for Lab4 or get into a new group. Please use the People link on the navigation menu to find groups. Visit Working in Groups to learn how to join a group. Detailed Specifications: Chapter 7 (Gaddis 18) introduces you to linked lists. In this lab assignment you will use the algorithms presented in this chapter to implement a phone book that keeps a list of names with respective phone numbers. The contacts should be kept in alphabetical order by their last name, then first name. No repetitions are allowed. You will adapt the Linked List Operations presented on Chapter 7 to work with a list of names and phone numbers. The header file is provided here: Contact.h Please note that list abstract data type on the zyBook has two pointers: head and tail. You only need head. The class that implements the phone book must have the following member functions: Constructor: should initialize the head to null. Destructor: should clean up the list. Note that this method must follow the algorithm that eliminates one node at a time. If you just set head to null, you create a memory leak in your program. Insert: must create a new node (with the name and phone number passed as parameters) and insert it in the list keeping it in alphabetical order. Delete: receives the name as a parameter, looks for the node that matches the name and removes it from the list. Print: traverses the list printing each contact (name and phone number) The following is a fair breakdown of the work needed to complete this lab in a group of 3 people: Person 1: This is the group leader and the person who will turn in all files, implements the main function that instantiates the phone book object, develops the appropriate logic to interface with the user asking for names to be inserted/deleted and calls the appropriate methods. Makes sure all files compile when put together. Test and attach the output as a comment at the end of main. Person 2: implements the insert and delete methods. Includes appropriate documentation of the function. Person 3: implements constructor, destructor and print (traverse). Includes appropriate documentation of the function. How to split the workload: Turn in: contactlist.cpp (with implementation of all member functions) and main.cpp (with the logic of the phone book operations). It is your responsibility to make sure the program compiles when all parts are put together. I won't grade your lab if I can't compile and test it. The group leader is responsible for turning in all files when done. Output: Take a screen shot of the testing you did. Insert at least 3 contacts, printing in between, remove each one of them, printing in between. Documentation: Follow lab documentation guidelines in all files. List all group members and explain who was responsible for what in the header comment at the beginning of all source files. Grading
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started