forked from kishanrajput23/Java-Projects-Collections
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbank account.java
43 lines (41 loc) · 1.04 KB
/
bank 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
class bank_account{
int account_no;
String name,type;
float amount;
void account_details(int bank_account,String nameOfCustomer,String typeName,float amout_details){
account_no=bank_account;
name=nameOfCustomer;
type=typeName;
amount=amout_details;
}
void show(){
System.out.println(account_no+" "+name+" "+type+" "+amount+" ");
}
void deposit(float d){
amount+=d;
System.out.println("Deposit amount: "+d);
}
void withdraw(float d){
if(amount>d){
amount-=d;
System.out.println("withdraw amount: "+d);
}
else{
System.out.println("Insufficient balance");
}
}
void get_account_balance(){
System.out.println("Your balance is: "+amount);
}
}
class bank{
public static void main(String[] args) {
bank_account n = new bank_account();
n.account_details(123456, "kritika", "saving", 1000);
n.show();
n.deposit(40000);
n.get_account_balance();
n.withdraw(10000);
n.get_account_balance();
}
}