-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBankAccount.java
More file actions
32 lines (27 loc) · 909 Bytes
/
BankAccount.java
File metadata and controls
32 lines (27 loc) · 909 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
public class BankAccount {
private double balance;
/**
* Constructor requiring we pass in a balance on instantiation
* @param balance the balance the user provided when creating their bank acct
*/
public BankAccount(double balance) {
this.balance = balance;
}
/**
* Will take the depositAmount and add it to the existing balance
* @param depositAmount the amount that should be added to the existing balance
*/
public void deposit(double depositAmount) {
balance += depositAmount;
}
/**
* Will take the withDrawAmount and subtract it from the existing balance
* @param withDrawAmount the amount that should be removed from the existing balance
*/
public void withdraw(double withDrawAmount) {
balance -= withDrawAmount;
}
public double getBalance() {
return balance;
}
}