Question: In C++ Thank you! Thumbs up TITLE IMPLEMENTING AN ORDERED LIST CLASS WITH A LINKED LIST INTRODUCTION An ordered list is a sequence of elements,

In C++

In C++ Thank you! Thumbs up TITLE IMPLEMENTING AN ORDERED LIST CLASS

WITH A LINKED LIST INTRODUCTION An ordered list is a sequence ofelements, all of the same type, that is ordered by the elements'

Thank you! Thumbs up

TITLE IMPLEMENTING AN ORDERED LIST CLASS WITH A LINKED LIST INTRODUCTION An ordered list is a sequence of elements, all of the same type, that is ordered by the elements' values. For example, is an ordered list of integers. Many kinds of data might be organized into ordered lists, and we often manipulate such structures in programs This project uses a class to implement an ordered list type and exercises that implementation. DESCRIPTION This project breaks neatly into two parts. First, implement an ordered list type in a class using a linked list, as we have described. You needn't consider how the list will be used until this step is complete. The elements of the class's lists will be integers, but it should be easy to change this type. Second, design and write a program that exercises and tests the class's list implementation. The exercising program should be menu-driven and interactive. The program will read and respond to commands that the user enters. It will manipulate an ordered list of integers provided by the List class. INPUT The program reads commands to manipulate its List. These commands consist of a letter followed perhaps by one integer. For example, the command "i 25" might tell the program to insert the value 25 into the List. OUTPUT The program writes to the terminal instructions and a menu of commands, and it prompts for the user's input. ERRORS The program may assume that the input the user provides is correct, except that it will report if a position is beyond the end of a list (See the example below). Otherwise, it need not detect any errors. EXAMPLE A run of the program might look something like this: This program responds to commands the user enters to manipulate an ordered list of integers, which is initially empty. In the following commands, v is any integer, and p is a position in the list. Re-initialize the list to be empty. iv -- Insert the value v into the list. rv -- Remove the value y from the list. 1 -- Report the length of the list. pv-- Is the value v present in the list? kn -- Report the nth value of the list. W -- Write out the list. h -- See this menu. q -- Quit. -->i 27 --> i 42 --> i 15 --> i 33 --> i 14 --> W List: -->r 33 --> W List: --> p 22 The value 22 is NOT present in the list. --> p 42 The value 42 is present in the list. --> k 3 The 3th element of the list is 27. -->k 9 The list does not contain 9 values. --> 9 This example does not illustrate everything the program might show tests of all its features. OTHER REQUIREMENTS Use a typedef statement to specify the item type in the class's lists, so that this type can be changed easily. Represent the elements of a list in a linked list. Maintain a list's elements in order in its linked list; this is part of the invariant of the implementation. To write out a list, overwrite the inserter operator ". HAND IN See About Programming Projects for a description of what to hand in design document, code, user document, tests, and summary. Include in the summary an answer to the following Question: Suggest another ordered list operation that a class like this might reasonably provide. TITLE IMPLEMENTING AN ORDERED LIST CLASS WITH A LINKED LIST INTRODUCTION An ordered list is a sequence of elements, all of the same type, that is ordered by the elements' values. For example, is an ordered list of integers. Many kinds of data might be organized into ordered lists, and we often manipulate such structures in programs This project uses a class to implement an ordered list type and exercises that implementation. DESCRIPTION This project breaks neatly into two parts. First, implement an ordered list type in a class using a linked list, as we have described. You needn't consider how the list will be used until this step is complete. The elements of the class's lists will be integers, but it should be easy to change this type. Second, design and write a program that exercises and tests the class's list implementation. The exercising program should be menu-driven and interactive. The program will read and respond to commands that the user enters. It will manipulate an ordered list of integers provided by the List class. INPUT The program reads commands to manipulate its List. These commands consist of a letter followed perhaps by one integer. For example, the command "i 25" might tell the program to insert the value 25 into the List. OUTPUT The program writes to the terminal instructions and a menu of commands, and it prompts for the user's input. ERRORS The program may assume that the input the user provides is correct, except that it will report if a position is beyond the end of a list (See the example below). Otherwise, it need not detect any errors. EXAMPLE A run of the program might look something like this: This program responds to commands the user enters to manipulate an ordered list of integers, which is initially empty. In the following commands, v is any integer, and p is a position in the list. Re-initialize the list to be empty. iv -- Insert the value v into the list. rv -- Remove the value y from the list. 1 -- Report the length of the list. pv-- Is the value v present in the list? kn -- Report the nth value of the list. W -- Write out the list. h -- See this menu. q -- Quit. -->i 27 --> i 42 --> i 15 --> i 33 --> i 14 --> W List: -->r 33 --> W List: --> p 22 The value 22 is NOT present in the list. --> p 42 The value 42 is present in the list. --> k 3 The 3th element of the list is 27. -->k 9 The list does not contain 9 values. --> 9 This example does not illustrate everything the program might show tests of all its features. OTHER REQUIREMENTS Use a typedef statement to specify the item type in the class's lists, so that this type can be changed easily. Represent the elements of a list in a linked list. Maintain a list's elements in order in its linked list; this is part of the invariant of the implementation. To write out a list, overwrite the inserter operator ". HAND IN See About Programming Projects for a description of what to hand in design document, code, user document, tests, and summary. Include in the summary an answer to the following Question: Suggest another ordered list operation that a class like this might reasonably provide

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!