Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1.(70) An organization that your little cousin belongs to is selling low-fat cookies. If your cousin's class sells more cookies than any other class, the

1.(70) An organization that your little cousin belongs to is selling low-fat cookies. If your cousin's class sells more cookies than any other class, the teacher has promised to take the whole class on a picnic. Of course, your cousin volunteered you to keep track of all the sales and determine the winner. Each class has an identification number. Each sales slip has the class identification number and the number of boxes sold. Input (Note: if you use keyboard for the input, it is ok for this assignment) Here is a sample of the data. (The classes are numbered from 1 through 10.)

Id. Number Boxes Sold

3 23

4 1

2 13

2 7

4 5

1 6

10 16

Output The following information written on file "boxes", all properly labeled. The total number of boxes sold by each class. The identification number of the winning class. If there is a tie, list all winners. Data Structures: using class UnsortedType defined in the textbook (chapter 3). The interface is provided as follows or you can include from the STL library. You can use either array or LinkedList as the fundamental data structure. (you need to justify your decision.) Deliverables Part I - Your design (objected-oriented design). (use diagrams, or pseudo-code, or CRC card to show your logical level design) Part II - A listing of your program (implementation of the program in C++) - A listing of your test plan as input to the program - A listing 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 of elements 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 of item is initialized. // Post: If there is an element someItem whose key matches // item's key, then found = true and item is a copy of // someItem; otherwise found = false and item is unchanged. // List is unchanged. void InsertItem(ItemType item); // Function: Adds item to list. // Pre: List has been initialized. // List is not full. // item is not in list. // Post: item is in list. void DeleteItem(ItemType item); // Function: Deletes the element whose key matches item's key. // Pre: List has been initialized. // Key member of item is initialized. // One and only one element in list has a key matching // item's key. // Post: No element in list has a key matching item's key. void ResetList(); // Function: Initializes current position for an iteration // through the list. // Pre: List has been initialized. // Post: Current position is prior to list. void GetNextItem(ItemType& item); // Function: Gets the next element in list. // Pre: List has been initialized and has not been changed since // last call. // Current position is defined. // Element at current position is not last in list. // Post: Current position is updated to next position. // item is a copy of element at current position.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions