Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ help Functional requirements: Inserts an item in the bag Determines if an item is in the bag Determines the number of copies of an

C++ help

Functional requirements:

Inserts an item in the bag

Determines if an item is in the bag

Determines the number of copies of an item in the bag

Determines the total number of items in the bag

Removes an item from the bag

Removes all items from the bag

The Program Spec

Implement a Bag container class that holds a collection of bag_type data items supporting the operations as specified above in the functional requirements.

Test Run Requirements: Only submit one run that shows a sample client that instantiates a Bag object and displays the test cases shown below:

Test run:

Insert a four into the bag

Fill the bag to capacity

Show the size of the bag

Display the number of fours in the bag

Remove a four from the bag

Show the size of the bag

Display the number of fours in the bag

Display the number of fives in the bag

Remove all fives in the bag

Display the number of fives in the bag

Paste a copy of your test run output display as a multi-line comment (i.e. use delimiters /* */ to encase your run) at the bottom of your test driver file.

Note: For purposes of demonstration set the bag CAPACITY to 20 items.

Grading Criteria:

Bag container class is correctly defined and implemented. Use a typedef to specify the bag_type data items to be collected.

Implementation supports the operations given in the functional requirements.

Mutators filter parameter data.

A constructor is specified to fulfill the precondition design requirement.

A test driver is included to satisfy the postcondition requirement.

Program compiles and runs.

A copy of your test run output display is included as a multi-line comment (i.e. use delimiters /* */ to encase your run) at the bottom of your test driver file.

Be sure to include 3 separate files:

bag.h

bag.cpp

bagDr.cpp

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases And Python Programming MySQL MongoDB OOP And Tkinter

Authors: R. PANNEERSELVAM

1st Edition

9357011331, 978-9357011334

More Books

Students also viewed these Databases questions