Sample Assignment 1 Report
Sample Assignment 1 Report
Submission Coversheet
Student ID Number
CON16423545
Academic Declaration:
Students are reminded that the electronic copy of their essay may be checked, at
any point during their degree, with Turnitin or other plagiarism detection software
for plagiarised material.
Date
Word Count 1524
Submitted
05/12/2017
CON16423545
2 | Page
Table of Contents
1. Design and development ................................................................3
1.1. Accounts Common Data Class .................................................4
2.2 Subclasses ...................................................................................8
2.3 Enum Classes .............................................................................11
2.4 Transaction Class........................................................................11
2.5 Menu Class .................................................................................13
2.6 Main class ................................................................................... 25
2. Test .............................................................................................. 26
2.1 Initial test ..................................................................................... 26
2.2 Adjustments ................................................................................28
3. References ................................................................................... 30
4. Appendices................................................................................... 30
CON16423545
3 | Page
Figure 1
Next, the key details will be discussed for each class together with
snapshots of code implementation.
CON16423545
4 | Page
Figure 2
CON16423545
5 | Page
Figure 3
Figure 3 provides the source code of the parent class variables declared
global as one of the requirements is to capture and store some customer
and accounts details (e.g. address, post code, overdraft …). Although
can be observed, few of the variables and the array list object are
declared final and the balance not, since it needs to be changed every
time the user perform an action such as withdraw, deposit or transfer.
However, a constructor needs to be defined to collect values.
Figure 4
CON16423545
6 | Page
Figure 6
Figure 5
Figure 7
CON16423545
7 | Page
Figure 8
CON16423545
8 | Page
2.2 Subclasses
According to Cadenhead (2018), inheritance is a powerful tool for object-
oriented languages and gives the ability of subclasses to acquire the
attributes and behaviours of the parent class. Once with inheritance, the
polymorphism principle adapts by extending an abstract class,
completing and/or modifying the appearance or behaviour of an object
given to it particular features (Oracle, 2017).
Figure 9
For instance, the image above shows the inheritance hierarchy where
the subclasses take the common data, then new features are added for
each of them (polymorphism).
CON16423545
9 | Page
Figure 10 BusinessAccount
Figure 11 PersonalAccount
CON16423545
10 | P a g e
Figure 12 PersonalAccount
Figure 13 PersonalAccountsUnder16
Figure 14 PersonalAccountsUnder16
CON16423545
11 | P a g e
Figure 15 Figure 16
This application has only three types of transactions and two types of
accounts plus a constraint for the personal account, therefore those
variables are stored into enum type.
Figure 17 Figure 18
Figure 19
CON16423545
12 | P a g e
Transaction class contains the data that needs to be stored for each
transaction to meet the requirements of the system, respectively date
when a transaction was accessed, type of transaction, the amount and
the balance after each one.
Figure 20
Figure 21
CON16423545
13 | P a g e
Figure 22
In the image above, a hash map has been declared, having the identifier
accounts. According to Cadenhead (2018), a hash map is a data
CON16423545
14 | P a g e
CON16423545
15 | P a g e
CON16423545
16 | P a g e
CON16423545
17 | P a g e
CON16423545
18 | P a g e
CON16423545
19 | P a g e
CON16423545
20 | P a g e
CON16423545
21 | P a g e
CON16423545
22 | P a g e
Here, the application must not allow withdrawing more than balance
amount and available overdraft, therefore an if statement is suitable for
this.
CON16423545
23 | P a g e
CON16423545
24 | P a g e
In order to display the right transactions in the right order, an array list
has been used, thus the transactions are easy to search through a for
loop finding the transaction index of the account number entered by the
user and access the transactions class methods.
CON16423545
25 | P a g e
CON16423545
26 | P a g e
2. Test
2.1 Initial test
2 existingAccountSubmenu Successful
3 findCustomerAccounts Successful
4 Exit Successful
2 createBAcc Successful
3 principalMenu Successful
CON16423545
27 | P a g e
balance Successful
overdraft Successful
CON16423545
28 | P a g e
5 principalMenu Successful
6 Exit Successful
2.2 Adjustments
1.
CON16423545
29 | P a g e
2.
CON16423545
30 | P a g e
3. References
Cadenhead R.(2018) Sams Teach Yourself Java in 24 hours.(8th Edition)
USA: Pearson.
Deitel P. and Deitel H.(2015) Java How to Program Early Objects. (10th
Edition) Essex: Pearson. Available at:
https://www.vlebooks.com/vleweb/Product/Index/463272?page=0
(Accessed: 18/11/2017).
Derek Banas (2012) UML 2.0 Class Diagrams [YouTube]. Available at:
https://youtu.be/3cmzqZzwNDM (Accessed: 02/12/2017).
4. Appendices
Transactions.java Menu.java
NationNarrowProject.
rar
CON16423545