Question
C++ Consider the classes class cashRegister and dispenserTypegiven in the Programming Example Juice Machine in Chapter 10 . In the class cashRegister, add the functions
C++ Consider the classes class cashRegister and dispenserTypegiven in the Programming Example Juice Machine in Chapter 10.
In the class cashRegister, add the functions to overload the binary operators + and to add and subtract an amount in a cash register; the relational operators to compare the amount in two cash registers; and the stream insertion operator for easy output.
The class dispenserType, in the Programming Example Juice Machine in Chapter 10, is designed to implement a dispenser to hold and release products. In this class, add the functions to overload the increment and decrement operators to increment and decrement the number of items by one, respectively, and the stream insertion operator for easy output.
Write a program to test the classes designed in steps 1 and 2.
class cashRegister
class cashRegister
{
public:
int getCurrentBalance() const;
void acceptAmount(int amountIn);
cashRegister(int cashIn=500);
private:
int cashOnHand;
};
class dispenserTypeGiven:
class dispenserType
{
public:
int getNoOfItems() const;
int getCost() const;
void makeSale();
dispenserType(int setNoOfItems = 50, int setCost = 50);
private:
int numberOfItems;
int cost;
};
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