Page 214 -
P. 214
modular programming
The program needs to create a
transaction file
The POS program will record credit card sales in a file called
transactions.txt. At the end of each day, this file is sent
to the bank and any money is transferred from the credit card
account into the health club’s bank account.
The bank has sent an example version of the file for you to see
what sort of data you will need to generate:
The first 16 characters are The next 7 characters The descriptions follow.
the credit card number. are the price.
62189672574056180000220 LATTE
75362847324839070000120 TEA
93343374684577850000150 DONUT
42657423454758780000095 GRAIN BAR
The file contains formatted data. There’s a line of text (or
record) for each item sold. The first 16 characters of the line
are the credit card number, followed by 7 characters that
represent the sale price, excluding the decimal point (so $1.75
is written as 0000175). The rest of the record is a description
of the item being sold.
How would you create a string of characters in the correct format for the
record? Which parts of the record will be the hardest to create?
you are here 4 179