All pastes #587688 Raw Edit

Mine

public text v1 · immutable
#587688 ·published 2007-06-25 00:00 UTC
rendered paste body
A separate program is required to store the interest rates for
different institutions for current accounts, savings accounts and
e-savings accounts. These interest rates should be printed out
on request.
(a) Create a new program in a file called
M150_TMA03_2007B_Q3(iv).html. Declare and initialise four
parallel arrays of size 10 for the institution names, the current
account rates, the savings account rates and the e-savings
account rates. Initialise the first three elements of these arrays
with the following values:
Institution name Current account
rate
Savings account
rate
e-savings
account rate
Pennygo Bank 2.0 4.0 4.5
Cardew Bank 1.5 3.75 4.75
Summer Bank 1.8 4.2 4.2
The remaining elements should contain 0 or '' as appropriate.
Write a function called addInstitution() to add a new
institution. This function will prompt the user for the name of
the institution and the interest rates and store these values in
the next free element of the appropriate arrays. If the arrays
are already full then an appropriate message to the user should
be printed. It can be assumed that the user will enter
appropriate data.
Write a function called displayRates() which will write the
name of each institution and the rates to the output window in
the following format:
Pennygo Bank:
Current Account 2.0%
Savings Account 4.0%
e-Savings Account 4.5%
Cardew Bank:
Current Account 1.5%
Savings Account 3.75%
e-Savings Account 4.75%
Write a main part of the program in which a user is repeatedly
asked whether they want to add a new institution (‘A’ or ‘a’),
print out the rates (‘P’ or ‘p’) or quit (‘Q’ or ‘q’) and which calls
the appropriate function. Note that the program should accept
the input in upper or lower case. If the user inputs an
unrecognised input then the program should just continue to
prompt for the next action.