Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ In this homework assignment, you will implement a Contact List class. Your ContactList should use a vector (from the STL) as the underlying structure,

C++ In this homework assignment, you will implement a Contact List class. Your ContactList should use a vector (from the STL) as the underlying structure, and should have the following functionality: Constructors: - A constructor that creates an empty ContactList. - A constructor that uses an array of Contacts and the size of that array in order to initialize the ContactList. (i.e. prototype ContactList(Contact* contacts, int numContacts); ) Operations: - A function that searches for a particular contact by last name, and returns a reference to the Contact. If there is no such Contact, a sentinel value should be returned. (like the default Contact.) (You will return a reference to the Contact, so that the user may call update() in order to change some information.) - A function that searches for a Contact by phone number, and returns a reference to the Contact. If there is no such Contact, a sentinel value should be returned. (like the default Contact.) (You will return a reference to the Contact, so that the user may call update() in order to change some information.) - A function that searches for and returns a vector containing all Contacts with a last name starting with a particular letter. If there are no such Contacts, you should return the empty vector. - A function that searches for and returns a vector containing all Contacts that live in a particular city. If there are no such Contacts, you should return the empty vector. - A function that allows you to add a Contact to the ContactList. You should only add a Contact to the list if it is not there already. - A function that returns the size of the ContactList. - A function that erases a contact from the contact list with a particular last name. Operators: - An overloaded [ ] operator that returns a Contact by reference at a certain index in the ContactList. You should throw an exception if the index is out of bounds. - An overloaded << operator that prints out a ContactList. You should print out each Contact using the << operator that you already defined on your Contact class. Please do not call all of the Contact classs accessor functions when you write this operator. Your private data should be a vector of Contacts. As usual, you may write as many private functions as youd like as helper functions to implement your class.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Big Data Concepts, Theories, And Applications

Authors: Shui Yu, Song Guo

1st Edition

3319277634, 9783319277639

More Books

Students also viewed these Databases questions

Question

What is outsourcing?

Answered: 1 week ago

Question

13-6 How will MIS help my career?

Answered: 1 week ago