Question: written in c# please :) A SortedList structure will sort the contents dynamically as the data is added to the structure, based on the identified

written in c# please :)

A SortedList structure will sort the contents dynamically as the data is added to the structure, based on the identified key. In this project, you will ask the user for information about products -- product ID (an integer) and name (string), then add the data to the sorted list. Print the list after each addition, to check that the data is sorted as expected. You will run this project twice -- once with the product ID as the key value, and once with the product Name as the key value.

Here is output for the list with the product ID as the key:

written in c# please :) A SortedList structure will sort the contents

Here is output for the list with the product name as the key:

dynamically as the data is added to the structure, based on the

In each version, as a new product is added to the list, you should be able to see that the list remains sorted

Create the project with the product ID as the key for the sorted list structure. Run it and add at least 4 products, which must NOT be in order. Take a screenshot of the results.

Change the project so that the product name is the key. Check the examples to see that the ID still prints first and then the name, when displaying the contents of the structure. Run it and add the same 4 products from the first version. Take a screenshot.

Ch 18 Sorted List by Student Name Enter product ID (integer): 567 Enter product name: note pad List contents 567 note pad Any more to add? Y/Ny Enter product ID (integer): 891 Enter product name: stapler List contents 567 note pad 891 stapler Any more to add? Y/Ny Enter product ID (integer): 122 Enter product name: pen List contents 567 note pad 122 pen 891 stapler Any more to add? Y/Ny Enter product ID (integer ): 345 Enter product name: pencil List contents 567 note pad 122 pen 345 pencil 891 stapler Any more to add? Y/Nn Press any key to continue

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!