Queen Mary University of London School of Electronic Engineering and Computer Science
EBU6304: Software Engineering
Lab 1: Java Inheritance and Polymorphism Revision
Exercise 1:
Copyright By PowCoder代写 加微信 powcoder
Recall the BankAccount class you studied in your year 2 in EBU4201 Java Programming module. (please refer to the extracted lecture notes on QM+). Write the BankAccount class, compile and run it.
Exercise 2:
Based on the basic BankAccount class, implement a CurrentAccount class. Descriptions:
A Bank Account has account number, account name and balance. Customers can pay in to the account, withdraw money from the account and check balance. A Current Account is a type of Bank Account that has an overdraft limit. Default overdraft limit is 500 yuan.
You should:
a) Draw a class diagram that show the attributes and operations of the CurrentAccount and
the relationship with BankAccount class. Hint: use Inheritance.
b) Write the Java code and test it.
Exercise 3:
Once you have both Bank Account and Current Account classes, implement a Bank class.
A Bank is a collection of accounts (can be normal Bank Account or Current Account). It can open new accounts, close accounts and operate on each account (such as deposit, withdraw and check balance). Current Accounts get a message if they are in overdraft state (balance<0).
You should:
a) Draw a class diagram of the Bank class, and show the relationship with other classes.
Hint: use Polymorphism.
b) Write the Java code and test it.
Submission:
• Class diagrams (BankAccount, CurrentAccount, Bank and their relationships)
o You can use any drawing tool or draw on paper and take a photo
• Java source code (all .java files)
Lab 1 page 1
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com