-
Notifications
You must be signed in to change notification settings - Fork 0
/
Account.java
94 lines (78 loc) · 2.65 KB
/
Account.java
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
public abstract class Account {
protected String accountId;
protected String accountholder;
protected double balance;
protected String accounttype;
protected double overdraftlimit;
public abstract void createAccount();
public void deposit(double amount)
{
System.out.println();
System.out.println("Account ID : " + getAccountId());
if(amount <= 5000)
{
System.out.println("Deposit atleast 100000");
System.out.println("-------------------------------------------------");
return;
}
balance += amount;
System.out.println("Deposited : " + amount + " to Account ID" + getAccountId());
System.out.println("Current Balance of "+ getAccountId()+ " : " + balance);
System.out.println("-------------------------------------------------");
}
public void withdraw(double amount)
{
System.out.println();
System.out.println("Account ID : " + getAccountId());
System.out.println("Withdrawing --------");
if(amount >= balance)
{
System.out.println("Invalid Withdraw Amount");
}
else
{
balance -= amount;
System.out.println("Withdraw :" + amount);
System.out.println("Current Balance of "+ getAccountId()+ " : " + balance);
}
System.out.println("-------------------------------------------------");
}
public void displayInformation(String accountid)
{
System.out.println("Account Type : " + getClass().getName());
System.out.println("Account ID : " + getAccountId());
System.out.println("Account Holder Name : " + getAccountholder());
System.out.println("Balance : " + getBalance());
}
public String getAccountId() {
return accountId;
}
public void setAccountId(String accountId) {
this.accountId = accountId;
}
public String getAccountholder() {
return accountholder;
}
public void setAccountholder(String accountholder) {
this.accountholder = accountholder;
}
public double getBalance() {
return balance;
}
public void setBalance(double balance) {
this.balance = balance;
}
public String getAccounttype() {
return accounttype;
}
public void setAccounttype(String accounttype) {
this.accounttype = accounttype;
}
public abstract void displayOverdraftLimit();
public double getOverdraftlimit() {
return overdraftlimit;
}
public void setOverdraftlimit(double overdraftlimit) {
this.overdraftlimit = overdraftlimit;
}
}