-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBaseTransaction.java
More file actions
41 lines (33 loc) · 972 Bytes
/
Copy pathBaseTransaction.java
File metadata and controls
41 lines (33 loc) · 972 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
33
34
35
36
37
38
39
40
41
import java.util.Calendar;
public class BaseTransaction implements TransactionInterface {
protected double amount;
protected Calendar date;
protected String transactionID;
public BaseTransaction(double amount, String transactionID) {
this.amount = amount;
this.transactionID = transactionID;
this.date = Calendar.getInstance();
}
@Override
public double getAmount() {
return amount;
}
@Override
public Calendar getDate() {
return date;
}
@Override
public String getTransactionID() {
return transactionID;
}
@Override
public void printTransactionDetails() {
System.out.println("Transaction ID: " + transactionID);
System.out.println("Amount: " + amount);
System.out.println("Date: " + date.getTime());
}
@Override
public void apply(BankAccount ba) {
System.out.println("Generic transaction applied.");
}
}