-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCurrentAccount.java
More file actions
54 lines (46 loc) · 1.54 KB
/
CurrentAccount.java
File metadata and controls
54 lines (46 loc) · 1.54 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
53
54
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package assignment.pkg1;
import java.util.Date;
import javax.swing.JOptionPane;
import javax.swing.JTextArea;
/**
*
* @author ee14ssr
*/
public class CurrentAccount extends Account {
private double Overdraft;
public CurrentAccount(Customer cust) {
super(cust);
Overdraft = 100;
accountType = "CurrentAccount";
}
public void displayCurrentAccount(JTextArea jAccountTextArea) {
super.Display(jAccountTextArea);
}
public void deposit(double Amount) {
balance = balance + Amount;
}
public void withdraw(double Amount, Date transactionDate) {
if (Amount > balance + Overdraft) {
JOptionPane.showMessageDialog(null, "Overdraft is greater than £100" + "\n" + "A £25.00 Transaction Charge will take effect until Overdraft decreases below £100");
balance = balance - Amount - 25;
transactions++;
} else {
balance = balance - Amount;
transactions++;
}
}
public void endMonth(Date transactionDate, JTextArea jAccountTextArea) {
long days = (transactionDate.getTime() - accountCreationDate.getTime()) / (1000 * 60 * 60 * 24);
if (days >= 31) {
jAccountTextArea.setText("");
balance = balance * rate;
transactions++;
endMonthUtil(jAccountTextArea);
}
}
}