Simple Bank Account







This   is simple  banking application  using core java  . Its  gives  simple information 
 about bank account. 





import java.util.*;
import java.text.*;


 class  Bank {
    String name
    int accno
    String acctype
    float bal;
    float dep_amt
    float wid_amt;
    

  
   void getdata(String s,int a,String at,float b)
    
      {
         name=s;
          accno=a; 
           acctype=at; 
            bal=b;
       }
       void deposit(float dm) {
        
           
       System.out.print("Bal before deposit is: "); 
       System.out.print(+bal);
       System.out.println();
        dep_amt=dm;
        bal=bal+dep_amt;
        System.out.println("Deposit amount:" +dm);
        System.out.println("the current balance is "+bal); 
        }
        void withdraw(float wm) {
          
         wid_amt=wm;
         System.out.println("Withdrwal Amount:"+wid_amt);
         if(wm >bal){
         System.out.println("Insufficient Balance");
         }else{
         bal=bal-wid_amt;
        
            System.out.println("the current balance is "+bal); 
         }
         } 
        }

    class BankAccount
    
     {
    
    
     public static void main(String args[]) {
    
          DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
            //get current date time with Date()
            Date date = new Date();
            System.out.println(dateFormat.format(date));
            //get current date time with Calendar()
           
    
     Bank bk=new Bank(); 
     bk.getdata("PANDU",1001,"Saving",12000);
     System.out.println("acc holders details are:"); 
     System.out.println("Name :"+bk.name); 
     System.out.println("Accno :"+bk.accno);
     System.out.println("AccType :"+bk.acctype); 
     System.out.println("Balance :"+bk.bal); 
     System.out.println();
    
     bk.deposit(2000);   
    
     bk.withdraw(1000);
    
     bk.withdraw(13500);
    
    
     }
     }


Program   Out put ...
2016/12/03 08:53:17
acc holders details are:
Name :PANDU
Accno :1001
AccType :Saving
Balance :12000.0

Bal before deposit is: 12000.0
Deposit amount:2000.0
the current balance is 14000.0
Withdrwal Amount:1000.0
the current balance is 13000.0
Withdrwal Amount:13500.0

Insufficient Balance
Simple Bank Account Simple Bank Account Reviewed by Mukesh Jha on 6:17 AM Rating: 5

No comments:

Add your comment

All Right Reserved To Mukesh Jha.. Theme images by Jason Morrow. Powered by Blogger.