A Cash Register Program

Objectives: a) Indefinite loops, b) Summing and counting, c) Named constant, d) data types int, double, String.
This program works like a Self-service Cash Register. A customer may purchase a number of items, some are taxable, and
some are not. The customer operating the register inputs a price of 0.00 to end the sentinel controlled loop. For each
item, the operator answers a yes/no question to indicate if the item is taxable. The yes/no question is to be answered by
just typing a single letter (y or n) or the words yes or no. The user may type this response in upper or lower case. The
program maintains two accumulator (summing) variables, one to add up the prices for all taxable items and one to add
up the prices of non-taxable items. Once the data input loop is over, the program calculates the tax due on the total
price of taxable items. The tax rate is to be defined as a named constant with value 0.0725 (7.25%). Since the result
from the tax computation may result in a number with more than 2 decimal digits, this result should be rounded to the
nearest penny (2 digits after decimal point). See later for the code of a function (method) that you may use for this
purpose. Other double values calculated may also have round-off errors, so they should also be rounded to 2 decimal
digits. The program displays a summary of all the purchased items (see the sample output).
Powered by