You operate a retail store with multiple cash registers. Define a class named CashRegister that has a
Question:
You operate a retail store with multiple cash registers. Define a class named CashRegisterthat has a member variable for a numeric register ID, a member variable to hold total amount of sales made at the register, and a member variable to hold the total count of sales made at the register. Make a constructor that allows a user of the class to initialize the register ID and set the starting sales to $0. Also make a method named saleMade() that gets called each time a new sale is made at the register. This method should take in the dollar amount of the sale. When called, it should update the total amount of sales for THIS register. It should also update a member field that tracks the total count of sales made at THIS register.
Also, add a static variable that tracks the total number (count) of sales across all cash registers. Add a corresponding static method called getAllRegisterSalesCount() that returns the value in this variable. Each time saleMade() is called, this static count field should also be updated.
Finally. add a toString() method that will return a formatted string similar to the following:
- Register# 1 has had 5 sales for a total of $5000.00. All registers together have made 25 sales.
Demonstrate a main() method to test your class with at least three registers.
Canadian Income Taxation Planning And Decision Making
ISBN: 9781259094330
17th Edition 2014-2015 Version
Authors: Joan Kitunen, William Buckwold