Page 220 -
P. 220
modular programming
Test Drive
The machine has been set up in the coffee bar just in time for the
boss to come in for his morning latte, so let’s run the code and see
what he thinks. Run the program in IDLE:
The sales are recorded in
the transactions.txt file.
63827462387648320000220 LATTE
63827462387648320000180 FILTER
The newline character
makes sure the sales are
recorded on separate lines.
(You can't see then in the
The program displays a list of items for sale and when you choose file, but they are there.)
one and provide a credit card number, it adds the sale into a file
called transactions.txt. This is the same file that the POS
system in the gym uses.
That looks pretty good.
We‛ll try it for a couple of
weeks here in the coffee
bar and see how it goes.
The boss agrees to try out the system in the coffee bar, and he even
agrees to extend the trial and let your friend create another POS
for the gym, based on your code.
Things are going really well. If they continue like
this, you will win the contract to replace all of the
systems at the health club!
you are here 4 185