Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This homework is from the following book: Starting Out with C++: From Control St

ID: 3628443 • Letter: T

Question

This homework is from the following book:
Starting Out with C++: From Control Structures Through Objects 6th Edition
by Tony Gaddis
ISBN: 0321545885
Chapter: 18
Page: 1,104
Problem # 12 (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.

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.

Note: You must use the stack structure with the dynamics lists implementation.

Explanation / Answer

#include "stdafx.h" #include #include #include #include "Inventory.h" using namespace std; int _tmain(int argc, _TCHAR* argv[]) { deque myInventoryQueue; char addremovedecision; bool finished = false; char done; int serial; int lot; string manufacture; deque::iterator Iter; while (!finished) { cout > addremovedecision; if (addremovedecision == 'A' || addremovedecision == 'a') { cout serial; cout > lot; cout > manufacture; getline(cin, manufacture); Inventory obj(serial, lot, manufacture); myInventoryQueue.push_back(obj); cout > done; if(done == 'D' || done == 'd') finished = true; } else if (addremovedecision == 'R' || addremovedecision == 'r') { cout
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote