Information Technology Reference
In-Depth Information
print “account # last name first name mi street address ”
“city state zip balance”
print account-number “ ” last-name “ ” first-name “ ” middle-initial “ ” street-address
“ ” city “ ” state “ ” zip-code “ ” ( balance, mask ($$$$,$$9.99))
The output would now be:
account # last name first name mi street address city st zip
balance
391023123 Smith Chris T 396 Main Street Buffalo NY 14225
$16.20
Note that the line on this page does not have 132 characters so what you see above is not
exactly what you would see on the actual report. The word balance and the value of it
would all be on the same line with the other data and there would be more spacing
between the fields. Also notice on this page that the headings for each field with the
appropriate value don't exactly line up. This is due to limitations in the word processing
software that I am using, which I can't do much about. Nobody said computers are
perfect. If the page you are reading does not have this discrepancy, it means that the
publisher took care of the problem. In any case, I think you get the idea.
There would be three spaces between the fields and more depending on the
values, specifically the name fields, which allow for more than the number of characters
that each name actually has. Thus there will be exactly four spaces between the # sign and
the label last and exactly three spaces between the last digit of the account number and
the first letter of the name, Smith . Note that we have our upper case designation for the
names, which means someone entered them correctly on the file.
Though our first print statement takes up two lines in our program, it will all print
on one line of our report. The same is true of the second print statement. The reason that
we have two lines each is because they physically don't fit on one line. If we had put the
keyword
print
before the literal city , then the labels of the fields would have printed on two lines which
is not what we want. On the second statement which print the values of all the fields, we
have a specific literal,
“ ”
printing after each field to separate the fields. This string consists of exactly three spaces.
I mentioned the keywords,
character ,
integer ,
signed
and
decimal ,
Search WWH ::




Custom Search