Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
Assesment Prog 2
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
gavin.white
Assesment Prog 2
Commits
3dfde2c5
Commit
3dfde2c5
authored
Dec 08, 2022
by
gavin.white
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Delete BankAccount.java
parent
e6364472
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
68 deletions
+0
-68
BankAccount.java
BankAccount.java
+0
-68
No files found.
BankAccount.java
deleted
100644 → 0
View file @
e6364472
public
class
BankAccount
{
// instance variables
private
double
balance
;
private
int
accountNumber
;
private
String
name
;
private
double
overdraftLimit
;
// constructor
public
BankAccount
(
int
accountNumber
,
String
name
)
{
this
.
accountNumber
=
accountNumber
;
this
.
name
=
name
;
this
.
balance
=
0.0
;
this
.
overdraftLimit
=
0.0
;
}
// methods
public
double
getBalance
()
{
return
this
.
balance
;
}
public
void
deposit
(
double
amount
)
{
this
.
balance
+=
amount
;
}
public
void
withdraw
(
double
amount
)
{
if
(
this
.
balance
+
this
.
overdraftLimit
>=
amount
)
{
this
.
balance
-=
amount
;
}
else
{
System
.
out
.
println
(
"Insufficient funds"
);
}
}
public
void
bankFees
()
{
// apply a 5% fee on the current balance
double
fee
=
this
.
balance
*
0.05
;
this
.
balance
-=
fee
;
}
public
void
display
()
{
System
.
out
.
println
(
"Account Number: "
+
this
.
accountNumber
);
System
.
out
.
println
(
"Account Holder: "
+
this
.
name
);
System
.
out
.
println
(
"Current Balance: "
+
this
.
balance
);
}
public
void
addOverdraft
(
double
overdraftLimit
)
{
this
.
overdraftLimit
=
overdraftLimit
;
}
}
class
SavingsAccount
extends
BankAccount
{
// constructor
public
SavingsAccount
(
int
accountNumber
,
String
name
)
{
super
(
accountNumber
,
name
);
}
// accrue interest on the current balance
public
void
accrueInterest
()
{
double
interest
=
this
.
getBalance
()
*
0.05
;
this
.
deposit
(
interest
);
}
// override the addOverdraft() method to prevent a SavingsAccount from having an
// overdraft limit
@Override
public
void
addOverdraft
(
double
overdraftLimit
)
{
// do nothing
}
}
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