Question
cash register design a cash register class that can be used with the InventoryItem class discussed in this chapter. the CashRegister class should be perform
cash register
design a cash register class that can be used with the InventoryItem class discussed in this chapter. the CashRegister class should be perform the following:
1, ask the user for the item and quantity being purchased.
2, get the item's cost from the InventoryItem object
3, add a 30 percent profit to the cost to get the items unit price
4, multiply the unit price times the quantity being purchased to get the purchase sub total
5, compute a 6 percent sales tax on the subtotal to get the purchase total
6, display the purchase subtotal, tax and total on the screen.
7, subtotal the quantity being purchased from the on hand variable of the InventoryItem class object
- implement both classes in a complete program. feel free to modify the InventoryItem class in any way necessary.
- input validation do not accept a negative value for the quantity of items being purchased
use the class definition file InventoryItem
use a class definition file for the CashRegister Calss
use an implementation program for the CashRegister class
use the program file
please submit Boths files. CashRegister class file, implementation program for the class, and the program file. please copy the code and screenshot too thanks.here is the InventoryItem.h please submit both three items
here is the InventoryItem.h
// This class has overloaded constructors.
#ifndef INVENTORYITEM_H
#define INVENTORYITEM_H
#include
usingnamespacestd;
classInventoryItem
{
private:
string description; // The item description
doublecost; // The item cost
intunits; // Number of units on hand
public:
// Constructor #1 (default constructor)
InventoryItem()
{ // Initialize description, cost, and units.
description = "";
cost = 0.0;
units = 0; }
// Constructor #2
InventoryItem(string desc)
{ // Assign the value to description.
description = desc;
// Initialize cost and units.
cost = 0.0;
units = 0; }
// Constructor #3
InventoryItem(string desc,doublec,intu)
{ // Assign values to description, cost, and units.
description = desc;
cost = c;
units = u; }
// Mutator functions
voidsetDescription(string d)
{ description = d; }
voidsetCost(doublec)
{ cost = c; }
voidsetUnits(intu)
{ units = u; }
// Accessor functions
string getDescription()const
{returndescription; }
doublegetCost()const
{returncost; }
intgetUnits()const
{returnunits; }
};
#endif
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