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

C++ ONLY The CashRegister.h file and the inventoryitem.h file along with main ne

ID: 3634866 • Letter: C

Question



C++ ONLY
The CashRegister.h file and the inventoryitem.h file along with main need to work together.

Design a CashRegister class that can be used with the InventoryItem class. The cashRegister class should perform the following.

1. Ask the user for the item and quantity being purchased.

2. Get the item's cpst from the InventoryItem object.

3. Add a 30% profit to the cost to get the item's unit price.

4. Multiply the unite price times the quantity being purchased to get the purchase subtotal

5. Compute a 6% sales tax on the subtotal to get the purchase total.

6. Display the purchase subtotal, tax, and the total on the screen.

7. Subtract the quantity being purchased from the onHand variable of the InventoryItem class object.

Implement both classes in a complete program. Input Validation: Do not accept a negative value for the quantity of items being purchased.

C++ ONLY
---------------------------------------------------------------------------------------------------------
//This is the inventory file, NEED THE CASHREGISTER CLASS
// inventoryitem.cpp : Defines the entry point for the console application.

// Specification file for the Inventory class
#ifndef INVENTORYITEM_H
#define INVENTORYITEM_H
#include <cstring> //Needed for strlen and strcpy


const int DEFAULT_SIZE=51;

// Inventory class declaration
class InventoryItem
{
private:
char *description;
int units;
double cost;

public:
// Default constructor
InventoryItem()
{ description = new char [DEFAULT_SIZE];

//store a null character in the first character
*description = '';

//initialize cost and units
cost=0.0;
units=0;
}

InventoryItem(char *desc)
{
description= new char [strlen(desc) + 1];

strcpy(description, desc);

cost=0.0;
units=0;
}

InventoryItem(char *desc, double c, int u)
{
description= new char [strlen(desc) + 1];

strcpy(description, desc);

cost=c;
units=u;
}

//Destructor
-InventoryItem()
{delete [] description;}

//mutator functions
void setDescription(char *d)
{
strcpy(descrption, d);
}

void setCost(double c)
{
cost=c;
}

void setUnits(int u)
{
units=u;
}

//Accessor Functions
const char *getDescription() const
{
return description;
}

double getCost() const
{
return cost;
}

int getUnits() const
{
return units;
}


};
#endif

Explanation / Answer

Dear,#ifndef TAX_H#define TAX_H//Tax class declarationclass Tax{private: double itemCost;//cost of the itemdouble taxRate;//sales tax ratepublic: //pull user input to get itemCost with tax rate 6%Tax(double subTotal, double rate = 0.06){itemCost = subTotal;taxRate = rate;}//get Item cost returndoubl hope it helps.plzz rate.thank you

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