Question: Assignment: Given the header file InventoryItem.h below, implement the class InventoryItem in a . cpp file. This class should include: C + + pls Data
Assignment: Given the header file InventoryItem.h below, implement the class InventoryItem in a cpp file. This class should include: C pls
Data Members
itemName: A string that holds the name of the inventory item.
quantity: An int that represents the quantity of the item currently in stock.
price: A double that indicates the price per item.
Constructors
Default Constructor: Initializes an InventoryItem object with default values itemName to an empty string, quantity to and price to
Parameterized Constructor: Accepts values for itemName, quantity, and price, and initializes an InventoryItem object with these values. In case of negative values provided for quantity
andor price, default values of should be used.
Public Member Functions:
getItemName: returns the item name.
getQuantity: returns the quantity of the item in stock.
getPrice: returns the price of the item.
setItemName: accepts a string and sets the item's name to the provided string value.
setPrice: accepts a double and sets the item's price to the provided double value. In case of a provided negative value, a default value of should be used.
calculateTotalValue: returns the total value of the inventory item, which is the product of the quantity in stock and the price per item.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
