Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A linked list is built in this lab. Make sure to keep track of the head node. (1) Define the class ContactNode per the following

A linked list is built in this lab. Make sure to keep track of the head node.

(1) Define the class ContactNode per the following specifications:

Private data members

string contactName

string contactPhoneNumber

ContactNode* nextNodePtr

Constructor with parameters for name followed by phone number (1 pt)

Public member functions

GetName() - Accessor (1 pt)

GetPhoneNumber() - Accessor (1 pt)

InsertAfter() (2 pts)

GetNext() - Accessor (1 pt)

PrintContactNode()

Ex: If the name is Roxanne Hughes and the phone number is 443-555-2864, PrintContactNode() outputs:

Name: Roxanne Hughes Phone number: 443-555-2864 

(2) Define main() to read the name and phone number for three contacts and output each contact. Create three ContactNodes and use the nodes to build a linked list. (2 pts)

Ex: If the input is:

Roxanne Hughes 443-555-2864 Juan Alberto Jr. 410-555-9385 Rachel Phillips 310-555-6610 

the output is:

Person 1: Roxanne Hughes, 443-555-2864 Person 2: Juan Alberto Jr., 410-555-9385 Person 3: Rachel Phillips, 310-555-6610 

(3) Output the linked list using a loop to output contacts one at a time. (2 pts)

Ex:

CONTACT LIST Name: Roxanne Hughes Phone number: 443-555-2864 Name: Juan Alberto Jr. Phone number: 410-555-9385 Name: Rachel Phillips Phone number: 310-555-6610

code is:

#include using namespace std;

class ContactNode { public: /* Declare member functions here */ private: /* Declare data members here */ };

/* Define member functions here */

int main() { /* Type your code here. */ return 0; }

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

Introduction To Data Mining

Authors: Pang Ning Tan, Michael Steinbach, Vipin Kumar

1st Edition

321321367, 978-0321321367

More Books

Students also viewed these Databases questions

Question

Answers request a clean venue explain what they are requesting

Answered: 1 week ago

Question

Understand the roles of signs, symbols, and artifacts.

Answered: 1 week ago

Question

Know the three main dimensions of the service environment.

Answered: 1 week ago