Cash Register

Short Description:

Write a program which will act as a cash register for a small coffee shop

This assignment is worth 50 points.

Goals

When you finish this homework, you should:

Formal Description

Write a program which will act as a cash register for a very small coffee shop. The shop offers two items for sale, a cup of coffee and a donut. The register is equipped with a scanner (you will simulate this with the keyboard), which reads in the number of each item purchased, followed by the cash tendered. Your program should compute the total sale, and the change returned.

The format for the input is is c,d:R|S|P where
letter meaningInput 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
For example the line

3,4:7|0|3
As 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 pebbles
All 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.

Discussion

You should make appropriate use of constants and variables.

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.

Design

You should design this program, including an program design, before you implement the code. This design should be a submitted on Friday September 30, and should include: Please print this design document and hand it in at the beginning of class.

Required Files

A single source code file and a design document.

Submission

Email your final source code file to danbennett360@gmail.com.