I know this qu is posted but I have not got the answer BY unsorted list...

70.2K

Verified Solution

Question

Programming

I know this qu is posted but I have not got the answer BYunsorted list using STLl!!

1.(70) An organizationthat your little cousin belongs to is selling low-fat cookies. Ifyour cousin's class sells more cookies than any other class, theteacher has promised to take the whole class on a picnic. Ofcourse, your cousin volunteered you to keep track of all the salesand determine the winner. Each class has an identification number.Each sales slip has the class identification number and the numberof boxes sold.

Input (Note: if you use keyboard for the input, it is ok for thisassignment) Here is a sample of the data. (The classes are numberedfrom 1 through 10.)

Id. Number BoxesSold

3 23

4 1

2 13

2 7

4 5

1 6

10 16  


Output The following information written on file \"boxes\", allproperly labeled. The total number of boxes sold by each class. Theidentification number of the winning class. If there is a tie, listall winners.

Data Structures: using class UnsortedType defined in the textbook(chapter 3). The interface is provided as follows or you caninclude from the STL library. You can use either array orLinkedList as the fundamental data structure. (you need to justifyyour decision.)

Deliverables

Part I - Your design (objected-oriented design). (use diagrams, orpseudo-code, or CRC card to show your logical level design) 

Part II - A listing of your program (implementation of the programin C++) - A listing of your test plan as input to the program - Alisting of the output file

Interface of UnsortedType class:

bool IsFull() const; // Function: Determines whether list is full.// Pre: List has been initialized.
// Post: Function value = (list is full)

int LengthIs() const; // Function: Determines the number ofelements in list. // Pre: List has been initialized. // Post:Function value = number of elements in list

void RetrieveItem(ItemType& item, bool& found); //Function: Retrieves list element whose key matches item's // key(if present). // Pre: List has been initialized. // Key member ofitem is initialized. // Post: If there is an element someItem whosekey matches // item's key, then found = true and item is a copy of// someItem; otherwise found = false and item is unchanged. // Listis unchanged.

void InsertItem(ItemType item); // Function: Adds item to list. //Pre: List has been initialized. // List is not full. // item is notin list. // Post: item is in list.

void DeleteItem(ItemType item); // Function: Deletes the elementwhose key matches item's key. // Pre: List has been initialized. //Key member of item is initialized. // One and only one element inlist has a key matching // item's key. // Post: No element in listhas a key matching item's key.

void ResetList(); // Function: Initializes current position for aniteration // through the list. // Pre: List has been initialized.// Post: Current position is prior to list.

void GetNextItem(ItemType& item); // Function: Gets the nextelement in list. // Pre: List has been initialized and has not beenchanged since // last call. // Current position is defined. //Element at current position is not last in list. // Post: Currentposition is updated to next position. // item is a copy of elementat current position.

Answer & Explanation Solved by verified expert
4.4 Ratings (867 Votes)
I will use Array as my data structure as number ofclasses is fix    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students