Question: Reimplement the CashRegister class so that it keeps track of the total price as an integer: The total cents of the price. For example, instead
Reimplement the CashRegister class so that it keeps track of the total price as an integer:
The total cents of the price. For example, instead of storing 17.29, store the integer 1729. Such an implementation is commonly used because it avoids the accumulation of roundoff errors. Do not change the public interface of the class.
Step by Step Solution
3.53 Rating (170 Votes )
There are 3 Steps involved in it
Comments and output attached To change this license header choose License Headers in Pro... View full answer
Get step-by-step solutions from verified subject matter experts
