Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ doubly Linked Lists - Complete the program below that keeps track of a telephone directory sorted by first name. Use the comments below to

C++

doubly Linked Lists - Complete the program below that keeps track of a telephone directory sorted by first name. Use the comments below to implement the routines that are not implemented.

image text in transcribed

image text in transcribedimage text in transcribed

#include

#include

using namespace std;

class DLL;

class Node

{

friend class DLL;

private:

string firstName;

string lastName;

string phoneNumber;

Node * nextRecord;

Node * previousRecord;

};

class DLL

{

private:

Node * head;

public:

DLL();

DLL(const DLL&); //optional

~DLL();

void insert(string, string, string);

void print();

void searchByName(string, string);

void remove(string, string);

};

//--------------------------------------------

//the default constructor

DLL::DLL()

{

}

//--------------------------------------------

//the copy constructor: optional

DLL::DLL(const DLL& source)

{

}

//--------------------------------------------

//the destructor

DLL::~DLL()

{

}

//--------------------------------------------

//print the linked list

void DLL::print ()

{

}

//--------------------------------------------

//search for a particular person in the list and print the

//corresponding phone number

void DLL::searchByName (string fName, string lName)

{

}

//--------------------------------------------

//create a node and insert it in the list in order (list

//should be sorted by the persons first name)

void DLL::insert (string fName, string lName, string phone)

{

}

//--------------------------------------------

//remove a person's record from the list

void DLL::remove (string fName, string lName)

{

}

//--------------------------------------------

int main ()

{

DLL list1;

list1.insert ("Mayssaa", "Najjar", "878-635-1234");

list1.insert ("Jim", "Meyer", "337-465-2345");

list1.insert ("Joe", "Didier", "352-654-1983");

list1.insert ("Yara", "Sarkis", "858-694-1787");

list1.insert ("Nancy", "Garcia", "617-227-5454");

list1.print();

list1.searchByName ("Nancy", "Garcia");

list1.remove ("Mayssaa", "Najjar");

list1.remove ("Yara", "Sarkis");

list1.remove ("Jim", "Meyer");

list1.print();

//this part is optional

DLL list2(list1);

list2.print();

return 0;

}

#include #include using namespace std; class DLL; class Node friend class DLL; private: string firstName; string lastName; string phoneNumber; Node * nextRecord; Node * previousRecord; class DLL private: public: Node * head; DLL ) DLL (const DLL&)//optional DLL void insert (string, string, string); void print); void searchByName (string, string) void remove (string, string); //thedefault constructor DLL:: DLL ( //the copy constructor: optional DLL: : DLL (const DLL& source)

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

Intelligent Information And Database Systems 6th Asian Conference Aciids 2014 Bangkok Thailand April 7 9 2014 Proceedings Part I 9 2014 Proceedings Part 1 Lnai 8397

Authors: Ngoc-Thanh Nguyen ,Boonwat Attachoo ,Bogdan Trawinski ,Kulwadee Somboonviwat

2014th Edition

3319054759, 978-3319054759

More Books

Students also viewed these Databases questions

Question

1. Identify three approaches to culture.

Answered: 1 week ago

Question

2. What is the meaning and definition of Banking?

Answered: 1 week ago

Question

3.What are the Importance / Role of Bank in Business?

Answered: 1 week ago