Question: 1.Implement the generic Box class discussed in the pdfs.2. Implement the findBox function discussed in the pdfs. Instead of an array of Boxes containing strings,

1.Implement the generic Box class discussed in the pdfs.2. Implement the findBoxfunction discussed in the pdfs. Instead of an array of Boxes containingstrings, i.e. Box, however, we want to search an array of Boxescontaining ints, i.e. Box. 3. Each box contains an int representing a1.Implement the generic Box class discussed in the pdfs.2. Implement the findBox function discussed in the pdfs. Instead of an array of Boxes containing strings, i.e. Box, however, we want to search an array of Boxes containing ints, i.e. Box. 3. Each box contains an int representing a social security number, and thus cannot be negative. Throw another logic_error exception if the user tries to search for a negative number 4. Write a main() function to set up a small array of Box elements, and use your findBox function inside of a try-catch block. Test out your catch block by entering invalid inputs, i.e. negative numbers and numbers that aren't in your Box array. just make existing function generic.

template class Box { private: ItemType item; public: void setItem(const ItemType & i) { item = i; } ItemType getItem() const { return item; } }; int main() { Box intBox; Box stringBox; intBox.setItem (7); stringBox.setItem("seven"); cout findBox (Box boxes[], int size, string target) { int i = 0; bool found false; while (!found && (i findBox (Box boxes[], int size, string target) { int i bool found false; while (!found && (i list[10]; Box searchBox; list[0].setItem ("GO"); list[1].setItem ("Giants"); try { searchBox = findBox (list, 2, "Dodgers"); } catch (logic_error logErr) { cout

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!