The only employer who will hire you is a local convenience store. The convenience store owner asks to you to write a billing system for the store.
The billing system must maintain a database of the prices of each item sold by the store. It also must print a bill for each customer.
Each item sold by the store can be uniquely identified by its barcode. A barcode is an integer of up to 8 digits.
Your billing system must read in commands setting the price of items and commands specifying the items a customer has bought.
Your billing system, should read in commands setting prices like this:
Kensington Kwiki-Mart Billing System Enter Command: price Enter barcode: 50653214 Enter name of the item: Vegemite 455g Enter price: 2.99 Enter Command: price Enter barcode: 93201704 Enter name of the item: Milk 1L Enter price: 1.2 Enter barcode: 83422184 Enter name of the item: Peanut Butter 375g Enter price: 1.7
Your billing system, should handle a change to the price of an item already in the database like this:
Enter Command: price Enter barcode: 72012988 Enter name of the item: Rinso - Economy Size Enter price: 7.20 Enter Command: price Enter barcode: 72012988 Enter new price for Rinso - Economy Size: 7.50 Enter Command:
When your program is asked to print a bill it will be given the barcodes of the items purchased.
The prices for these items will have been previously entered into the system as above.
Note, we only want one line printed on the bill when a customer purchases several of the same item.
Here is how your billing system should print a bill.
Enter Command: bill Enter barcode: 72012988 Enter barcode: 50653214 Enter barcode: 93201704 Enter barcode: 93201704 Enter barcode: 83422184 Enter barcode: 50653214 Enter barcode: 93201704 Enter barcode: 0 1x Peanut Butter 375g @$1.70 = $1.70 3x Milk 1L @$1.20 = $3.60 2x Vegemite 455g @$2.99 = $5.98 1x Rinso - Economy Size @$7.50 = $7.50 Total: $18.78 Thank for Shopping at Kensington Kwiki-Mart Enter Command:
Design your program from the top down.
You should use a number of functions in your program.
Before writing any code for any functions, decide on the fields and method signatures for all classes.
Implement functions from the top down.