Answered step by step
Verified Expert Solution
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 bas 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 member. Fach 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 C4) - A listing of your test plan as input to the program - A listing of the output file Interface of Unsorted Type class: bool I Fullo const; 1/Function: Determines whether list is full 1/ 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(Item Type& 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 Il someItem; otherwise found = false and item is unchanged. // List is unchanged. void InsertItem(Item Type 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(Item Type item); 1/ Function: Deletes the element whose key matches item's key. Il 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 ResetListo; // Function: Initializes current position for an iteration // through the list. // Pre: List has been initialized. // Post: Current position is prior to list. void GetNextItem(Item Type& item); // Function: Gets the next element in list. // Pre: List has been initialized and has not been changed since I last call 1/ Current position is defined. // Element at curent position is not last in list. // Post: Curent 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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started