CHAPTER 4 EXERCISES
1 Study the following statement:
75 ON X GOTO 50, 90, 130, 50
A. What statement number will control be transferred to, if the integer
value of X is 2?
B. What integer value of X will cause control to
be transferred to statement number 130?
C. What, if any, integer value(s) of X will cause control to be transferred
to line number 50?
2. Write an ON-GOTO statement to branch to line 60 if age (A) is 10-19,
to line 80 if age is 20-39, to line 150 if age is 40-59 and
to line 180 if age is 60-65. (Assume there are no ages less than
10 or greater than 65.)
3. Refer to the program in figure 4-2.
A. What condition would cause lines 70 and 80 to be executed?
B. If the value 216 is entered as variable X and you ask for F
to C conversion, what are the line numbers of the statements that
would be executed?
C. What is the purpose of statements 170-190?
4. Given a monthly beginning bank balance and a list of transactions (deposits
and checks), write a program to list deposits and checks, and
compute and print the balance after each transaction. If ending balance
is $500.00 or less, print a message that says A SERVICE CHARGE
OF $4.00 HAS BEEN DEDUCTED FROM YOUR ACCOUNT.
YOUR FINAL BALANCE IS ___________.
The beginning balance is to be entered at the
time of program execution, transactions are
to be stored in the program. Use zero (0) to indicate end
of data. Use a loop to read and process the transactions.
Beginning balance $2450.25
Transactions 50.00 check
37.40 check
320.45 deposit
100.20 check
25.00 deposit
85.35 check
250.00 check
200.00 deposit
|