Question
Analyze the algorithms, provide a brief review of the stack(s) included, and explain the time complexity of the individual functions (push & pop). ====================================================================================== Programs:
Analyze the algorithms, provide a brief review of the stack(s) included, and explain the time complexity of the individual functions (push & pop).
======================================================================================
Programs:
InventoryItem.h:
// Specification file for the InventoryItem class
#ifndef INVENTORYITEM_H #define INVENTORYITEM_H #include
class InventoryItem { private: long serialNum; //integer variable for serial number string manufactDate; //member that holds the date for part manfactured int lotNum; //integer hold the lot number public: InventoryItem() { serialNum=0; //integer variable for serial number manufactDate="01/01/2000"; //set default date as 01/01/2000 lotNum=0; } // Constructor InventoryItem(long serialNum, string manufactDate,int lotNum) { setSerialNum(serialNum); setManufactDate (manufactDate); setLotNum(lotNum); } // define mutators here void setSerialNum(long serialNum) { this->serialNum = serialNum; } void setManufactDate (string manufactDate) { this->manufactDate = manufactDate; } void setLotNum(int lotNum) { this->lotNum=lotNum; } // define accessors here long getSerialNum() const { return serialNum;//return serial Number of the manufactured item } string getManufactDate() { return manufactDate;//return Date of the manufactured item } int getLotNum() { return lotNum; } friend ostream& operator<<(ostream &out,InventoryItem &item) { out << "\tSerial number: " << item.getSerialNum() << endl; out << "\tManufacture date: " << item.getManufactDate() << endl; out << "\tLotNum: " << item.getLotNum() << endl; return out; }
};
#endif
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Stack.h:
// Dynamic type stack class that can hold objects of any class. #include
template
template
template
template
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Inventory.cpp:
#include
int main() { Stack
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started