Professional Documents
Culture Documents
The application
A small high-street commercial bank wishes to computerise their operations. You are required to
implement their system in Java.
Current account information includes an integer account number and customer name. The first current
account opened is number 1000. Each account has an overdraft limit. The overdraft limit can be set
when the account is opened; otherwise the default overdraft limit is zero. No interest is paid on credit
balances. Debit balances (overdrafts) are charged interest at 45% per annum. You may assume that
interest operations are only applied at the end of each month. No interest applies in the period
between the date of closing the account and the end of the previous month. Deposit transactions are
charged a service fee of $2.50 each. Withdrawal transactions are charged a service fee of $5.00 each.
Savings account information includes an integer account number and the customer name. The first
savings account opened has number 2000. Deposit transactions are free. Withdrawal transactions are
charged a service fee of $5.00 each. Savings accounts may not be overdrawn. Interest of 25% per
annum is paid on the current balance. You may assume that interest operations are only applied at the
end of each month. No interest applies in the period between the date of closing the account and the
end of the previous month.
Investment account information includes an integer account number and the customer name. The first
investment account opened has number 3000. Deposit and withdrawal transactions are free.
Customers may make as many deposits as they wish but they may make only a single withdrawal
transaction after which the account is closed. Investment accounts may not be overdrawn. Interest of
35% per annum is paid on the current balance. You may assume that interest operations are only
applied at the end of each month. No interest applies in the period between the date of closing the
account and the end of the previous month.
Question 1
The bank requires Java classes and methods to model their customer accounts.
1.1 Give public classes named CurrentAccount, SavingsAccount and InvestmentAccount together
with whatever additional classes you need to implement bank accounts. Include all the
instance fields required to implement the required design, but include only only the minimum
methods required to implement the operations of the following main() method.
1.2 Give a public class AccountTest containing only a main() method which opens the following
accounts, in order. Immediately after a customer account has been opened you must print its
value to the console in the following format:
Number 1234
Type: Current(or Savings or Investment, as applicable)
Name: Zanamwe Ngonidzashe
Balance: $1200.00
<Blank line>
Page 1 of 4
a. A current account for customer Fred Clinton
b. A current account for customer Brok Monday with an overdraft limit of $200
c. A savings account for customer Wilma Fredstone
d. An investment account for customer Tod Esra [25]
Question 2
2.2 Give a public class AccountTest1 containing only the main() method which implements the
following transactions, in order and prints in the format previously specified the value of each
customer account to the console after each transaction:
Page 2 of 4
t. print the bank’s own current account value
Invalid transactions, such as attempting to withdraw an amount larger than the available balance must
be silently ignored. [30]
Question 3
The bank wishes to store all customer account information in a single ledger. Accounts are stored in
the ledger immediately after they are created, in the order in which they are created. Speed of
operation is irrelevant.
Provide appropriate public classes and methods to implement the ledger as an object of class
ArrayList. You will need to adjust the semantics of some operations described in question 2. For
example, the operation to close an account in question 2 becomes an operation to remove an account
from the ledger. Provide a method to print in the format previously specified the value of each
customer account in the ledger in the order in which they are stored.
Give a public class AccountTest3 containing only main() method which implements the transactions
given in question 2 in order (but do not print account values after each transaction), and print the
complete ledger to the console immediately after transactions c, f, j, k, p and t. The ledger is empty
when your program starts.
Question 4 [10]
Using Netbeans, develop a desktop application which allows users to calculate the present value or
future value of an amount of money. The application must have text fields which accept the interest
rate, time in years, and the amount of money to be discounted or compounded. The application must
have an additional text field which shall be used for displaying the result. The text fields should be
clearly labelled. Further the application should have two buttons one labelled Future Value and
Present Value. If the Future Value button is clicked the future value must be displayed in the text field
labelled result. If the Present Value button is clicked the present value must be displayed in the text
field labelled result. Your class must be named TValue
Question 5 [10]
a. Write a program that reads the contents of file named infile.java (in the folder named Exam)
and display the contents on the console screen. The class must be named InputFile.
[5]
b. Modify your program so that it reads input from a file named infile.java and output it in
another file named outfile.java which must be in the folder named Exam. The class must be
named OutputFile. [5]
Page 3 of 4
Question 6 [20]
Develop a complete query application for orders and products. The database for the application is
called OrederedProducts and has four relations (attributes for each are shown in brackets) shown
below:
Customer(CustomerID,Cname)
Your application should have predefined queries with an appropriate query for each application
shown in a JComboBox. You should provide the following queries:
Question 7 [10]
You are given the following marks for each course being done by students in the department of
computer science.
Declare a 2 dimensional array and initialise it with the marks in the table above.
Using looping structures print the marks for each student on the same line. After that print a blank line
then print the average mark for each student followed by another blank line then print the lowest mark
for each student. You program should at the same time store the average mark of each student in
another one dimensional array. Lastly the program should calculate and display the average mark for
each course and also store it in a one dimensional array. Don’t use more than two loops.
Page 4 of 4