Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.67 KB | None | 0 0
  1. package AG_Banks;
  2. public class AG_Account
  3. {
  4.     private int myAccount;
  5.     public int AG_account(int startmoney)
  6.     {
  7.         myAccount = startmoney;
  8.         return myAccount;
  9.     }
  10.     public int AG_account()
  11.     {
  12.         myAccount = 0;
  13.         return myAccount;
  14.     }
  15.     public void deposit(int amount)
  16.     {
  17.         myAccount = myAccount + amount;
  18.     }
  19.     public int withdraw(int amount)
  20.     {
  21.         if(myAccount >= amount)
  22.         {
  23.             myAccount = myAccount - amount;
  24.             return amount;
  25.         }
  26.         if(myAccount < amount)
  27.         {
  28.             int x = 35;
  29.             myAccount.overdraft(x);
  30.             return 0;
  31.         }
  32.     }
  33.     public int getbalance()
  34.     {
  35.         return myAccount;
  36.     }
  37.     private void overdraft(int amount)
  38.     {
  39.         myAccount = myAccount - 35;
  40.     }
  41.    
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement