Question: Multi part question regarding the bag class. Based on the screenshots: E) Write your own test program to display the results of the implemented functions.

Multi part question regarding the bag class. Based on the screenshots:

E) Write your own test program to display the results of the implemented functions. Be sure to document your test program.

F) Write a summary of what your test program fully tests the bag class. Include a copy of the output after your summary.

G) Answer the following questions about the original code:

1) Are all member functions defined in the implementation file? If not, explain why the code still works.

2) Are all member and non-member functions tested by the original test program? If not, list those that were not tested.

3) Why do you think the namespace main_savitch code was used? Can the code be made to work without this code?

bag.h

Multi part question regarding the bag class. Based on the screenshots: E)

bag.cpp

Write your own test program to display the results of the implemented

testbag.cpp

functions. Be sure to document your test program. F) Write a summary

E#ifndef MAIN. SAVITCH. BAGI. H 60 61 62 #define MAIN SAVITCH BAGI H #includecstdlb> // Provides sizet - 64 65 namespace main savitch3 :class bag 67 68 69 70 71 72 73 : public: :I/ TYPEDEFS and MEMBER CONSTANTS typedef int value_type; typedef std::size_t size_type; static const size_type CAPACITY = 30; : // CONSTRUCTOR bag) used - 0; :// MODIFICATION MEMBER FUNCTIONS 75 76 size_type erase(const value_type& target); :bool erase_one(const value_type& target); Void insert(const value_type& entry); void operator +(const bag& addend); 79 80 /1 CONSTANT MEMBER FUNCTIONS :size_type size() const return used; y size_type count (const value_type& target) const; 83 84 85 86 87 private: :value_type data[CAPACITY]; // The array to store items size_type used; // How much of array is used // NONMEMBER FUNCTIONS for the bag class bag operator +(const bag& b1, const bag& b2); 89 90 #endif

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!