Question: Objective: Developing a simple class, using vector and console input/output. We want to write a program for a phone calling list. Step 1. Develop a

Objective: Developing a simple class, using vector and console input/output.

We want to write a program for a phone calling list. Step 1. Develop a class name CallingList (CallingList.hpp, CallingList.cpp) inside the namespace phone.

CallingList class will have the following public methods:

CallingList(); o Constructor by default. It will create an empty calling list.

CallingList(const CallingList& orig); o Copy Constructor. It will create a calling list as a copy of the parameter.

~CallingList(); o Destructor.

void add(string name, string phone); o It adds a pair name/phone into the calling list. If the phone number was in the calling list,

name will be updated instead of inserting a new one.

vector getPhone(string name) const; o It returns a vector with all the phone number of one person.

string getName(string phone) const; o It returns the name associated to a phone number.

void printList() const; o It prints the phone calling list.

void remove(string phone); o It removes an entry from the calling list searching by the phone number.

And it will use this private data definition: struct Person {

 string name; string phone; 
 }; vector list; 

#include #include #include #include #include

#include "CallingList.hpp"

using namespace std; using namespace Phone;

void Pause(); char Menu(); bool Confirm();

int main(int argc,char** argv) { char option; bool exit = false; CallingList callingList; string name, phone; vector list; while (!exit) { option = Menu(); switch(option){ case 'A': break; case 'B': break; case 'C': break; case 'D': break; case 'E': break; case 'X': exit=Confirm(); break; default: cout << "Wrong Option ... " << endl; break; } cout << endl; Pause(); } return 0; } void Pause() { string s; cout << endl << "Press ENTER to Continue ..."; getline(cin,s); system("clear"); } char Menu() { char op; cout << "\tLab 6" <> op; cin.ignore(); op = toupper(op); return op; } bool Confirm() { char yes_no; cout << "Are you sure (Y/N)?"; cin >> yes_no; cin.ignore(); yes_no = toupper(yes_no); return (yes_no=='Y'); }

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!