Please do my lab, I cant figure it out.
I’m trying to learn for my Computer Science class and I’m stuck. Can you help?
Lab 2a: Unsorted Phone Book
We are in need of a phone book which we can store contacts – individuals’ first names and phone numbers. Your list of contacts will be unsorted.
For the implementation, you will need a class for Contact objects. The Contact class will contain the contact attributes: first name and phone number.
You will keep the list of Contact instances in a second class, the AddressBook container class. This container class will have an aggregate relationship with the Contact class. This means it will contain and maintain the unsorted list of Contacts.
The AddressBook container class should implement an array style list of Contact objects. C++ vectors are not allowed for Lab 2a.
When the program starts it should open to a main menu with these choices:
- Add Contact
- Find Contact
- Edit Contact
- Delete Contact
- Display Current Contact
- Display All Contacts
Your phone book app needs to be structured like this:
- Put each class in its own .cpp file. Each class also needs its own .h file
- Put your menu and app code that uses the classes in main.cpp
- Use the starter .h files provided here.
- Your first step should be to create the .cpp file for each class, with empty functions implementing the class members, and a main.cpp file with the necessary #includes but just outputs “Hello, World!”
- Second step: compile and link the first step above with no errors or warnings.
- Third step: implement the Phone Book functionality with an unsorted array list.
- If you have trouble, come to my office hour and the Friday 10am Zoom meeting.
- Don’t forget to comment your code!
Lab 2b: Persistent AddressBook using Sorted Linked List
You will begin Lab 2b with your completed code for Lab 2a. Modify your Lab 2a code to:
- maintain an alphabetically sorted list of Contacts
- use a sorted linked list instead of an array.
- store Contacts to a datafile.
- If the datafile already exists, your app will populate the AddressBook list with Contacts from the file.
You should be able to just change the private members of the AddressBook class, and your AddressBook.cpp code. Start with this .h file: