Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions bank account.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
class bank_account{
int account_no;
String name,type;
float amount;

void account_details(int a,String b,String c,float d){
account_no=a;
name=b;
type=c;
amount=d;
}
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();
}
}