Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

this is chpater 18 material its just adding the two new function i think Using the material in the textbook (NumberList) as a sample, design

this is chpater 18 material its just adding the two new function i think

Using the material in the textbook (NumberList) as a sample, design your own dynamic linked list class (using pointers) to hold a series of capital letters. The class should have the following member functions:

append, insert (at a specific position, return -1 if that position doesn't exist), delete (at a specific position, return -1 if that position doesn't exist), print, reverse (which rearranges the nodes in the list so that their order is reversed), and search (which returns the position of a specific value in the list. Assume the first node is position 0. If the items is not found, then return a -1 which will tell the calling function that that value does not exist)

Create a menu-driven program to demonstrate your linked list capabilities.

Low level validation

1. Mutator functions which are given a node value that is not a capital letter should have an exit_failure.

2. Mutator functions which are told to access a node that doesn't exist should return a -1 so that the calling function can handle the problem. (No exit_failure used in this case b/c the calling function can't know if the node is there or not.)

Program Level Validation

If a call to a mutator returns a -1 that will indicate that the node is not found. Display an appropriate error message to the user and then cycle back to the menu again. For example:

1. Append

2. Insert

3. Delete

4. Print

5. Reverse

6. Search

Please choose a menu option:

2

What value do you wish to insert?

B

What position to do wish to insert?

3

**I'm sorry but there is no position 3 in the linked list.

1. Append

2. Insert

3. Delete

4. Print

5. Reverse

6. Search

Please choose a menu option:

***********

Make sure that you have proper constructors and destructors (a destructor must delete every node). Make your input and output professional. Break your code down into functions so as to maintain modular design. No global variables.

Demo your program as follows:

append node

append node

append node

append node

append node

print list

insert at position

print list

delete at position

print list

reverse

print list

search list

---------------

Here's a jing from a previous semester showing what the linked list assignment has to do. It uses integers in it's list instead of capital letters, but o/w it's the same.

https://www.screencast.com/t/w4OeB05A

---------------

Submit to me:

1. all of your .cpp and .h files.

2. A jing that shows me the demo above

Funcitonal Requirements: Using the Programming Assignment from Chapter 18 (Linked List) as a place to start, please complete the following:

1. Review your grading notes from Chapter 18 PA and fix the errors.

2. Add the following functionality to your menu:

Count Number of Nodes.

Display the Largest Node in the list.

Programming Rules:

1. Review the grading notes for your Chapter 18 (Linked List) submission. Using the grading notes and the good example that was posted, get your code to work properly.

2. Modify your menu to add these two items: Count Number of Nodes and Display Largest Node.

3. Add the following to your previous class (the one you created for Chapter 18):

numNodes which returns the number of nodes in the linked list, and

maxNode which should return the largest value** stored in the list. **Note, assume Z has a higher value than A.

4. In both cases, use recursion in the function to traverse the list. If you do not use recursion to traverse the list then you will lose 25 points on this assignment. This is not me kidding around. Since the code for numNodes and it's associated private member function, countNodes, is written in the book, this is not a terribly taxing assignment.

----------------------

Demo the program as follows:

append node

append node

append node

append node

append node

print list

insert at position

display list

display number of nodes

display max node

delete at position

print list

display number of nodes

display max node

----------------

Submit to me:

1. all of your .cpp and .h files.

2. One Jing that shows me the demo as requested above.

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

MySQL/PHP Database Applications

Authors: Jay Greenspan, Brad Bulger

1st Edition

978-0764535376

More Books

Students also viewed these Databases questions