Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Design your own linked list class named IntList to hold a series of integers. Include the following public member functions, named as shown: Member Function

Design your own linked list class named IntList to hold a series of integers.

Include the following public member functions, named as shown:

Member Function

Description

Default Constructor

Creates an empty list.

Copy Constructor

Accepts an IntList object passed by reference. Makes nodes in the current object for each node in the object passed in and copies the integers from the object passed in into the current object.

appendNode

Accepts an integer argument. Allocates a new node, stores the passed value into the node and appends the node to the end of the list.

insertNode

Accepts an integer argument. Allocates a new node, stores the passed value into the node and inserts the node into the list so that the nodes are in increasing numerical order.

deleteNode

Accepts an integer argument. Searches for the node that contains the passed value and deletes it from the list. To delete a node: remove it from the list without breaking the links created by the next pointers & delete the memory allocated for the node.

displayList

Displays the entire list to the monitor. For each node, this function prints the node number and the value stored in the node.

sumList

Calculate and return the sum of the values in the lists nodes.

reverseList

Extra Credit: Reverses the order of the list, so that the node that was first is now last and the node that was last is now first. You need to actually change the order of the nodes, not just print them in reverse order.

Destructor

Destroys the list.

All member functions must be written outside the class declaration and stored in a separate file as directed below.

Write a program (main) to test your class. Be sure to test all of the constructors and public member functions.

Save the program (main) in a file named integers.cpp. Save the class declaration in a file named IntList.h. Save the member functions for the class in a file named IntList.cpp.

Compile, run and test your program

Update your Program Design Document by updating the class and program descriptions to fit your working program. Update the time estimates based on actual time spent. Save the updated document.

Submit your updated design document and working .h and .cpp files in the Program 8 drop box. For this assignment, you should submit one file in the Program 8 Design drop box and 4 files in the Program 8 drop box.

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

Sybase Database Administrators Handbook

Authors: Brian Hitchcock

1st Edition

0133574776, 978-0133574777

More Books

Students also viewed these Databases questions

Question

Which personal relationships influenced you the most?

Answered: 1 week ago