Question: This is a C ++ assignment. I don't care about any of the other objects mentioned in the question, I'm done with them. you don't

This is a C ++ assignment.

I don't care about any of the other objects mentioned in the question, I'm done with them.

you don't need to write the main part. Thank you.

class ContactList

  • Private member data: head (a pointer to a Contact object). Note: you can have a pointer to an abstract object but you can't instantiate an abstract object. We will be instantiating "concrete" objects: EmployeeContact objects and ContractorContact objects when building this ContactList.
  • Constructor
    • Default constructor: initialize head to nullptr.
  • Destructor: free memory for all nodes in the linked list to avoid memory leak.
  • Private member function (used internally only):
    • FindContact: take a constant reference to a Name object. Search the ContactList for a match using the overloaded operator == defined in the Name class. If found return the pointer to the found Contact. Otherwise return nullptr.
    • Insert: take a pointer to a Contact object): add a Contact object to the front of the linked list. Note: the pointer parameter must be pointing to a dynamically allocated EmployeeContact or ContractorContact object prior to the Insert function's invocation.
  • Public member functions:
    • Init: manually (hard-coded) build the list. See Code Helper section at the end of the specs. We should read a text file here but I will give you some break.
    • ShowAllContacts: take no parameter. Traverse through the entire linked list to invoke ShowContact function for each node. The function should also show a header:

Name Title Department Location Business Phone Email

  • SearchByName: take a constant reference to a Name object as its only parameter. Invoke the FindContact function. If the returned pointer it not nullptr show the contact info. Otherwise display an error message.
  • SearchByDepartment: take a department as its only parameter. Search the whole linked list looking for EmployeeContact objects only. Display employee contact info if and only if the employee is working for the requested department.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!