-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSavingsAccount.java
More file actions
52 lines (44 loc) · 1.21 KB
/
SavingsAccount.java
File metadata and controls
52 lines (44 loc) · 1.21 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
public class SavingsAccount implements BankAccountDecorator{
private int accountNumber;
private String accountName;
private double balance;
public int getAccountNumber() {
return accountNumber;
}
public void setAccountNumber(int accountNumber) {
this.accountNumber = accountNumber;
}
public String getAccountName() {
return accountName;
}
public void setAccountName(String accountName) {
this.accountName = accountName;
}
public void setBalance(double balance) {
this.balance = balance;
}
@Override
public String showAccountType(){
return "Savings Account";
}
@Override
public double getInterestRate() {
return 0.01; // 1%
}
@Override
public double getBalance() {
return balance;
}
@Override
public double computeBalanceWithInterest() {
return balance + (balance * getInterestRate());
}
@Override
public String showBenefits() {
return "Standard Savings Account";
}
@Override
public String showInfo() {
return "Account Number: " + accountNumber + "\nAccount Name: " + accountName + "\nBalance: " + balance;
}
}