Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
Assessment Exercise 3
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sam.pople
Assessment Exercise 3
Commits
e941d94b
Commit
e941d94b
authored
Jun 05, 2022
by
sam.pople
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new final submission
parent
538f5eea
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
15 deletions
+8
-15
BankAccount.class
bin/BankAccount.class
+0
-0
SavingsAccount.class
bin/SavingsAccount.class
+0
-0
BankAccount.java
src/BankAccount.java
+6
-13
SavingsAccount.java
src/SavingsAccount.java
+2
-2
No files found.
bin/BankAccount.class
View file @
e941d94b
No preview for this file type
bin/SavingsAccount.class
View file @
e941d94b
No preview for this file type
src/BankAccount.java
View file @
e941d94b
...
@@ -2,22 +2,22 @@ public class BankAccount {
...
@@ -2,22 +2,22 @@ public class BankAccount {
// Transactions are in pence
// Transactions are in pence
public
BankAccount
(
int
account
n
umber
,
String
name
,
int
balance
)
{
public
BankAccount
(
int
account
N
umber
,
String
name
,
int
balance
)
{
this
.
Accountnumbervalue
(
account
n
umber
);
this
.
Accountnumbervalue
(
account
N
umber
);
this
.
Namevalue
(
name
);
this
.
Namevalue
(
name
);
this
.
Balancevalue
(
balance
);
this
.
Balancevalue
(
balance
);
}
}
private
int
account
n
umber
;
private
int
account
N
umber
;
private
String
name
;
private
String
name
;
private
int
balance
;
private
int
balance
;
private
double
fees
=
0.95
;
private
double
fees
=
0.95
;
protected
int
overdraft
=
0
;
protected
int
overdraft
=
0
;
public
int
getAccountNumber
()
{
public
int
getAccountNumber
()
{
return
account
n
umber
;
return
account
N
umber
;
}
}
public
String
getName
()
{
public
String
getName
()
{
return
name
;
return
name
;
...
@@ -32,8 +32,8 @@ public class BankAccount {
...
@@ -32,8 +32,8 @@ public class BankAccount {
return
overdraft
;
return
overdraft
;
}
}
public
void
Accountnumbervalue
(
int
account
n
umber
)
{
public
void
Accountnumbervalue
(
int
account
N
umber
)
{
this
.
account
number
=
accountn
umber
;
this
.
account
Number
=
accountN
umber
;
}
}
public
void
Namevalue
(
String
name
)
{
public
void
Namevalue
(
String
name
)
{
this
.
name
=
name
;
this
.
name
=
name
;
...
@@ -86,7 +86,6 @@ public class BankAccount {
...
@@ -86,7 +86,6 @@ public class BankAccount {
if
(
this
.
getBalance
()
+
this
.
getOverdraft
()
<
amount
)
{
if
(
this
.
getBalance
()
+
this
.
getOverdraft
()
<
amount
)
{
System
.
out
.
println
(
"Not enough funds for a withdrawal \n"
);
System
.
out
.
println
(
"Not enough funds for a withdrawal \n"
);
return
false
;
return
false
;
}
else
{
}
else
{
this
.
Balancevalue
(
this
.
getBalance
()
-
amount
);
this
.
Balancevalue
(
this
.
getBalance
()
-
amount
);
System
.
out
.
println
(
"Withdrawal successful "
+
this
.
formatAmount
(
amount
)
+
"\n"
);
System
.
out
.
println
(
"Withdrawal successful "
+
this
.
formatAmount
(
amount
)
+
"\n"
);
...
@@ -95,18 +94,12 @@ public class BankAccount {
...
@@ -95,18 +94,12 @@ public class BankAccount {
}
}
public
void
bankFees
()
throws
Exception
{
public
void
bankFees
()
throws
Exception
{
this
.
Balancevalue
(((
int
)
Math
.
round
(
this
.
getBalance
()*
this
.
getFees
())));
this
.
Balancevalue
(((
int
)
Math
.
round
(
this
.
getBalance
()*
this
.
getFees
())));
}
}
public
void
display
()
throws
Exception
{
public
void
display
()
throws
Exception
{
System
.
out
.
println
(
"Bank details: \n"
);
System
.
out
.
println
(
"Bank details: \n"
);
System
.
out
.
println
(
"Account no.: "
+
this
.
getAccountNumber
()
+
"\nAccount holder: "
+
this
.
getName
());
System
.
out
.
println
(
"Account no.: "
+
this
.
getAccountNumber
()
+
"\nAccount holder: "
+
this
.
getName
());
String
balance
=
this
.
formatAmount
(
this
.
getBalance
());
String
balance
=
this
.
formatAmount
(
this
.
getBalance
());
System
.
out
.
println
(
"Balance: "
+
balance
);
System
.
out
.
println
(
"Balance: "
+
balance
);
}
}
}
}
src/SavingsAccount.java
View file @
e941d94b
public
class
SavingsAccount
extends
BankAccount
{
public
class
SavingsAccount
extends
BankAccount
{
public
SavingsAccount
(
int
account
n
umber
,
String
name
,
int
balance
)
{
public
SavingsAccount
(
int
account
N
umber
,
String
name
,
int
balance
)
{
super
(
account
n
umber
,
name
,
balance
);
super
(
account
N
umber
,
name
,
balance
);
this
.
Feesvalue
(
1.00
);
this
.
Feesvalue
(
1.00
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment