Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

IN C++: Design, implement, and test a class that represents a tool box that stores wrenches. Your class must provide members for maximum number of

IN C++: Design, implement, and test a class that represents a tool box that stores wrenches. Your class must provide members for maximum number of wrenches and current number of wrenches (for example, a tool box having a maximum number of wrenches of 8 can hold only 8 wrenches -- when the box has 8 wrenches and an attempt is made to add another wrench then the box must empty itself (reset number of wrenches to 0) before adding the new wrench). The class must have a default constructor--the default constructor will use a NAMED CONSTANT to set the maximum wrench items member to the default value of 8. You must have a second constructor that allows the user to choose a maximum wrench count other than the default (this maximum wrench count should be a parameter to the constructor). Your class must also include the following member methods: add a wrench, get current wrench count, and empty tool box.

Use your new class in a small program that creates at least two tool box objects (one with the default constructor and one with the second constructor) and calls their member methods such that the methods are demonstrated properly (for example, create a tool box object with maximum size of 5, then call your add wrench method 3 times, then call the get wrench count method to ensure that the class is working properly.)

Turn in output showing that your program methods do what they're supposed to do (I recommend purling output statements in your main program interspersed with the calls to your object methods. By tracing those statements, and comparing the value returned by your get wrench count method, you can ensure that things are working properly.

Be sure to use only named constants for all constants in the program.

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

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

Recommended Textbook for

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions

Question

5. This question is about disjoint set. (20%) G H M T S Z W

Answered: 1 week ago