Yuvalxp8

bankAccount

Oct 11th, 2017
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.11 KB | None | 0 0
  1.  
  2. public class bankAccount
  3. {
  4.     String name;
  5.     double money;
  6.    
  7.     public bankAccount(String name , double money)
  8.     {
  9.         this.name = name ;
  10.         this.money = money ;
  11.     }
  12.    
  13.     public bankAccount(String name)
  14.     {
  15.         this.name = name ;
  16.         this.money = 0 ;
  17.     }
  18.    
  19.     public double amountOfMoney(double money)
  20.     {
  21.         return this.money ;
  22.     }
  23.    
  24.     public void deposit(double money)
  25.     {
  26.         this.money += money;
  27.     }
  28.    
  29.     public void withdrawal(double money)
  30.     {
  31.         this.money -= money;
  32.     }
  33.  
  34.     public String getName()
  35.     {
  36.         return name;
  37.     }
  38.  
  39.     public void setName(String name)
  40.     {
  41.         this.name = name;
  42.     }
  43.  
  44.     public double getMoney()
  45.     {
  46.         return money;
  47.     }
  48.  
  49.     public void setMoney(double money)
  50.     {
  51.         this.money = money;
  52.     }
  53.  
  54.     public String toString()
  55.     {
  56.         return "bankAccount [name=" + name + ", money=" + money + "]";
  57.     }
  58.    
  59.     public void unionAccount(bankAccount difAccount)
  60.     {
  61.         this.money += difAccount.getMoney();
  62.     }
  63.    
  64.     public void Accounts(bankAccount[] bankArr)
  65.     {
  66.         for(int i = 0 ; i < bankArr.length ; i ++)
  67.             System.out.print("[" + bankArr[i].toString());
  68.         System.out.print("]");
  69.         System.out.println();
  70.     }
  71.    
  72. }
Add Comment
Please, Sign In to add comment