Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package AG_Banks;
- public class AG_Account
- {
- private int myAccount;
- public int AG_account(int startmoney)
- {
- myAccount = startmoney;
- return myAccount;
- }
- public int AG_account()
- {
- myAccount = 0;
- return myAccount;
- }
- public void deposit(int amount)
- {
- myAccount = myAccount + amount;
- }
- public int withdraw(int amount)
- {
- if(myAccount >= amount)
- {
- myAccount = myAccount - amount;
- return amount;
- }
- if(myAccount < amount)
- {
- int x = 35;
- myAccount.overdraft(x);
- return 0;
- }
- }
- public int getbalance()
- {
- return myAccount;
- }
- private void overdraft(int amount)
- {
- myAccount = myAccount - 35;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement