Answered step by step
Verified Expert Solution
Question
1 Approved Answer
URGENT C++ QUESTION CS1337 Assignment 5 An Inventory class specification can be defined with the following header: class InventoryItem public: / Constructor InventoryItem (char desc,
URGENT C++ QUESTION
CS1337 Assignment 5 An "Inventory" class specification can be defined with the following header: class InventoryItem public: / Constructor InventoryItem (char desc, double c, int u) // Destructor InventoryItem ) const char *getDescription ) const double getCost ) const; int getUnits) const private: char *description; I/ The item description double cost; int units; // The item cost Number of units on hand This class models an item sold at a store. Question1: Finish the specification with whatever code needed (additional attributes and methods) in a header file, then write an implementation for this class (always in a separate "cpp" file) Question2: Add a static member variable to "InventoryItem" class called number_articles, of type "int". This variable should keep how item articles are sold by the store. Add a static member function called getNumberArticles that return that number Question3: Overload the operator"for class "Inventoryltem". The overloaded operator will allow printing the content of an "Inventoryltem" object following the example format bellow: Inventory Item: description-Mars chocolate bar, unit cost-1.09, quantity is stock-5 Question4: Write a description/implementation for a new class called CashRegister. This class will be used with the InventoryItem class defined earlier (always separate header and implementation file). The CashRegister class should perform the following Ask the user for the item and quantity being purchased. Get the item's cost from the Inventory object. Add a 30% profit to the cost to get the item's unit price. Multiply the unit price times the quantity being purchased to get the purchase subtotal. Compute a 6% sales tax on the subtotal to get the purchase total. Display the purchase subtotal, tax, and total on the screen. Subtract the quantity being purchased from the number of units on hand variable of the InventoryItem class object. Implement both classes, as well as a main function (in its own separate main.cpp). Main code should simulate creation of a stock of item in a first step (which can be static, i.e. no user input), then the process of buyers purchasing items (which should be dynamic, by asking the user which items to purchase). At the end the main will print how the remaining stock information (total number of articles, list of each item description and units in hand). Input Validation: Do not accept a negative value for the quantity of items being purchased. Submit a zip file containing all cpp and header files, as well as project file, according to assignment guidelines. CS1337 Assignment 5 An "Inventory" class specification can be defined with the following header: class InventoryItem public: / Constructor InventoryItem (char desc, double c, int u) // Destructor InventoryItem ) const char *getDescription ) const double getCost ) const; int getUnits) const private: char *description; I/ The item description double cost; int units; // The item cost Number of units on hand This class models an item sold at a store. Question1: Finish the specification with whatever code needed (additional attributes and methods) in a header file, then write an implementation for this class (always in a separate "cpp" file) Question2: Add a static member variable to "InventoryItem" class called number_articles, of type "int". This variable should keep how item articles are sold by the store. Add a static member function called getNumberArticles that return that number Question3: Overload the operator"for class "Inventoryltem". The overloaded operator will allow printing the content of an "Inventoryltem" object following the example format bellow: Inventory Item: description-Mars chocolate bar, unit cost-1.09, quantity is stock-5 Question4: Write a description/implementation for a new class called CashRegister. This class will be used with the InventoryItem class defined earlier (always separate header and implementation file). The CashRegister class should perform the following Ask the user for the item and quantity being purchased. Get the item's cost from the Inventory object. Add a 30% profit to the cost to get the item's unit price. Multiply the unit price times the quantity being purchased to get the purchase subtotal. Compute a 6% sales tax on the subtotal to get the purchase total. Display the purchase subtotal, tax, and total on the screen. Subtract the quantity being purchased from the number of units on hand variable of the InventoryItem class object. Implement both classes, as well as a main function (in its own separate main.cpp). Main code should simulate creation of a stock of item in a first step (which can be static, i.e. no user input), then the process of buyers purchasing items (which should be dynamic, by asking the user which items to purchase). At the end the main will print how the remaining stock information (total number of articles, list of each item description and units in hand). Input Validation: Do not accept a negative value for the quantity of items being purchased. Submit a zip file containing all cpp and header files, as well as project file, according to assignment guidelinesStep 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