-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAccount.java
107 lines (77 loc) · 1.7 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
95
96
97
98
99
100
101
102
103
104
105
106
107
public class Account
{
private String accountHolderName; //instance
private int accountNumber; //instance
private double balance; //instance
private static int count; //class
public Account() //Default Constructor
{
accountHolderName="ram";
accountNumber=1;
balance=1;
count++;
}
public Account(String n,int a,double b) //Paramatrize Constructor
{
accountHolderName=n;
accountNumber=a;
balance=b;
count++;
}
public void setAccountNumber(int a) //setter
{
accountNumber= a;
}
public void setAccountHolderName(String a) //setter
{
accountHolderName= a;
}
public void setBalance(double a) //setter
{
balance= a;
}
public void setAccountDetail(String n, int a , int c) //setter
{
accountHolderName = n;
accountNumber= a;
balance=c;
}
public void getAccountDetail() //getter
{
System.out.println(accountHolderName +" :: "+accountNumber+" :: "+balance);
}
public int getAccountNumber() //getter
{
return accountNumber;
}
public String getAccountHolderName() //getter
{
return accountHolderName;
}
public double getAccountBalance() //getter
{
return balance;
}
public void withdrawlAmount(int b) //Bussiness Logic
{
if(b<balance){
balance= balance-b;
System.out.println(balance);
}
else
System.out.println("Withdrawl not possible due to insufficient fund");
}
public void depositAmount(int b) //Bussiness Logic
{
balance= balance+b;
System.out.println(balance);
}
public static int getCount() //Object Creation Count
{
return count;
}
public String toString() //toString
{
return accountNumber+" "+accountHolderName+" "+balance;
}
}