-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCheckingAccount.java
More file actions
49 lines (37 loc) · 1.12 KB
/
CheckingAccount.java
File metadata and controls
49 lines (37 loc) · 1.12 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
//Program Name: CheckingAccount
//Author: Joshua Decker
//Class: CSC110
//Date Written: 4/17/2022
//Brief Description: Derived class of BankAccount that has additional functionality
package ch12;
import java.text.NumberFormat;
class CheckingAccount extends BankAccount {
private double transactionFee;
public CheckingAccount() {
super();
transactionFee = 1.00;
}
public CheckingAccount(int acctNo, double initBalance, String owner,double transactionFee) {
super(acctNo, initBalance, owner);
this.transactionFee = transactionFee;
}
public double getTransactionFee() {
return transactionFee;
}
public void setTransactionFee(double transactionFee) {
this.transactionFee = transactionFee;
}
@Override
public void deposit(double amount) {
super.deposit(amount - transactionFee);
}
@Override
public void withdraw(double amount) {
super.withdraw(amount - transactionFee);
}
@Override
public String toString() {
NumberFormat fmt = NumberFormat.getCurrencyInstance();
return (super.toString() + " transaction fee = " + fmt.format(transactionFee));
}
}