Starting Out with C++ from Control Structures through Objects Brief, Student Value Edition (8th Edition)
bartleby

Concept explainers

bartleby

Videos

Textbook Question
Book Icon
Chapter 18, Problem 12PC

Inventory Bin Stack

Design an inventory class that stores the following members:

serialNum: An integer that holds a part’s serial number.

manufactDate: A member that holds the date the part was manufactured.

lotNum: An integer that holds the part’s lot number.

The class should have appropriate member functions for storing data into, and retrieving data from, these members.

Next, design a stack class that can hold objects of the class described above. If you wish, you may use the template you designed in Programming Challenge 1 or 2.

Last, design a program that uses the stack class described above. The program should have a loop that asks the user if he or she wishes to add a part to inventory, or take a part from inventory. The loop should repeat until the user is finished.

If the user wishes to add a part to inventory, the program should ask for the serial number, date of manufacture, and lot number. The data should be stored in an inventory object, and pushed onto the stack.

If the user wishes to take a part from inventory, the program should pop the top-most part from the stack and display the contents of its member variables.

When the user finishes the program, it should display the contents of the member values of all the objects that remain on the stack.

Blurred answer
Students have asked these similar questions
Part 2.  Library Class Implement a class, Library, as described in the class diagram below. Library must implement the Comparable interface. The compareTo() method must compare the branch names and only the branch names. The comparison must be case insensitive. The equals() method must compare the branch names and only the branch names. The comparison must be case insensitive. Be sure to test the equals() and compareTo() methods before proceeding.   Library - state: String - branch: String - city: String - zip: String - county: String - int squareFeet: int - int hoursOpen: int - int weeksOpen: int + Library(state: String, branch: String, city: String, zip: String, county: String, squareFeet: int, hoursOpen: int, weeksOpen: int) + getState(): String + getBranch(): String + getCity(): String + getZip(): String + getCounty(): String + getSquareFeet(): int + getHoursOpen(): int + getWeeksOpen(): int + setState(state: String): void + setBranch(branch: String):void +…
C++ (Last time the solution was unclear with errors)  Write a class template that uses a vector to implement a stack data structure with these member functions: 1. (constructor) : Construct stack (public member function ) 2. empty : Test whether container is empty (public member function ) 3. size : Return size (public member function ) 4. top : Access next element (public member function ) 5. push : Insert element (public member function ) 6. pop : Remove top element (public member function ) Put function definitions outside the definition of the class (i.e. inline functions are not allowed).
7. Dynamic MathStack The MathStack class shown in this chapter has only two member functions: add and sub. Write the following additional member functions: Function Description mult Pops the top two values off the stack, multiplies them, and pushes their product onto the stack. div Pops the top two values off the stack, divides the second value by the first, and pushes the quotient onto the stack. addAll Pops all values off the stack, adds them, and pushes their sum onto the stack. multA11 Pops all values off the stack, multiplies them, and pushes their prod- uct onto the stack. Demonstrate the class with a driver program. here is the extention file please use it. // Specification file for the IntStack class #ifndef INTSTACK_H #define INTSTACK_H   class IntStack { private:    int *stackArray;  // Pointer to the stack array    int stackSize;    // The stack size    int top;          // Indicates the top of the stack   public:    // Constructor    IntStack(int);      // Copy constructor…

Chapter 18 Solutions

Starting Out with C++ from Control Structures through Objects Brief, Student Value Edition (8th Edition)

Additional Engineering Textbook Solutions

Find more solutions based on key concepts
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
9.1: What is an Array? - Processing Tutorial; Author: The Coding Train;https://www.youtube.com/watch?v=NptnmWvkbTw;License: Standard Youtube License