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
05f45cf0
Commit
05f45cf0
authored
Jun 05, 2022
by
sam.pople
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fss
parent
30341077
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
18 deletions
+6
-18
BankAccount.class
bin/BankAccount.class
+0
-0
BankAccount.class
src/BankAccount.class
+0
-0
BankAccount.java
src/BankAccount.java
+6
-18
No files found.
bin/BankAccount.class
View file @
05f45cf0
No preview for this file type
src/BankAccount.class
View file @
05f45cf0
No preview for this file type
src/BankAccount.java
View file @
05f45cf0
...
@@ -3,13 +3,10 @@ public class BankAccount {
...
@@ -3,13 +3,10 @@ public class BankAccount {
// Transactions are in pence
// Transactions are in pence
public
BankAccount
(
int
accountNumber
,
String
name
,
int
balance
)
{
public
BankAccount
(
int
accountNumber
,
String
name
,
int
balance
)
{
this
.
Accountnumbervalue
(
accountNumber
);
this
.
Accountnumbervalue
(
accountNumber
);
this
.
Namevalue
(
name
);
this
.
Namevalue
(
name
);
this
.
Balancevalue
(
balance
);
this
.
Balancevalue
(
balance
);
}
}
private
int
accountNumber
;
private
int
accountNumber
;
private
String
name
;
private
String
name
;
private
int
balance
;
private
int
balance
;
...
@@ -51,40 +48,32 @@ public class BankAccount {
...
@@ -51,40 +48,32 @@ public class BankAccount {
public
String
formatAmount
(
int
amount
)
throws
Exception
{
public
String
formatAmount
(
int
amount
)
throws
Exception
{
String
string
;
String
string
;
boolean
negative
;
boolean
negative
;
if
(
amount
<
0
)
{
if
(
amount
<
0
)
{
string
=
String
.
valueOf
(
amount
*
-
1
);
string
=
String
.
valueOf
(
amount
*
-
1
);
negative
=
true
;
negative
=
true
;
}
}
else
{
else
{
string
=
String
.
valueOf
(
amount
);
string
=
String
.
valueOf
(
amount
);
negative
=
false
;
negative
=
false
;
}
}
if
(
string
.
length
()
==
1
)
{
if
(
string
.
length
()
==
1
)
{
string
=
"00"
+
string
;
string
=
"00"
+
string
;
}
}
if
(
string
.
length
()
==
2
)
{
if
(
string
.
length
()
==
2
)
{
}
}
if
(
negative
)
{
if
(
negative
)
{
return
"-£"
+
string
.
substring
(
0
,
string
.
length
()
-
2
)
+
"."
+
string
.
substring
(
string
.
length
()
-
2
,
string
.
length
());
return
"-£"
+
string
.
substring
(
0
,
string
.
length
()
-
2
)
+
"."
+
string
.
substring
(
string
.
length
()
-
2
,
string
.
length
());
}
else
{
}
else
{
return
"£"
+
string
.
substring
(
0
,
string
.
length
()
-
2
)
+
"."
+
string
.
substring
(
string
.
length
()
-
2
,
string
.
length
());
return
"£"
+
string
.
substring
(
0
,
string
.
length
()
-
2
)
+
"."
+
string
.
substring
(
string
.
length
()
-
2
,
string
.
length
());
}
}
}
}
public
void
deposit
(
int
amount
)
throws
Exception
{
public
void
deposit
(
int
amount
)
throws
Exception
{
this
.
Balancevalue
(
this
.
getBalance
()
+
amount
);
this
.
Balancevalue
(
this
.
getBalance
()
+
amount
);
}
}
public
boolean
withdrawal
(
int
amount
)
throws
Exception
{
public
boolean
withdrawal
(
int
amount
)
throws
Exception
{
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
{
...
@@ -93,9 +82,8 @@ public class BankAccount {
...
@@ -93,9 +82,8 @@ public class BankAccount {
return
true
;
return
true
;
}
}
}
}
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"
);
...
...
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