This assignment is worth 50 points.
The format for the input is is c,d:R|S|P where
letter | meaning | Input Range |
---|---|---|
c | Cups of Coffee Purchased | integer, 0 or more |
d | Donuts Purchased | integer, 0 or more |
R | Rocks Tendered. | integer, 0 or more |
S | Stones Tendered | integer, 0 or more |
P | Pebbles Tendered | integer, 0 or more |
3,4:7|0|3As you will notice, you are selling your wares in a country where the basic units of exchange are Rocks, Stones and Pebbles. The exchange rate tends to fluctuate, but right now the value is 1 rock = 5 stones. 1 stone = 5 pebbles. Your program should be easy to modify if currency breaks down and this rate changes.
You are currently charging 1|0|2 for a cup of coffee (1 rock and 2 pebbles), and 0|4|3 for a donut. You are, however, thinking of changing this and want your program to be easy to modify should you make this move.
In the above example, the customer has purchased a total of 6 rocks 4 stones and 3 pebbles worth of goods, but has tendered 7 rocks 3 pebbles. They will need change of 1 stone.
Your customers are all very careful to give you at least the amount required to pay their bill, but may give extra and require change.
Your program should produce output in the following format:
Enter the input from the scanner => 3.4:7|0|3 Cups of Coffee: 3 Donuts Purchased: 4 Total Bill: 6 rocks 4 stones 3 pebbles Cash Tendered: 7 rocks 0 stones 3 pebbles Change: 0 rocks 1 stones 0 pebblesAll output should be aligned as above. All amounts should be reduced to the minimal amount of currency required to render that amount. You may assume that your cash register has an unlimited amount of currency with which to make change.
Your identifiers should be constructed properly, with meaningful names.
You should document your code with comments.
Your output should be organized, easy to read, and make appropriate use of white space.