Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package AG_Banks;
- public class AG_Account {
- public int money;
- public int bills;
- public AG_Account(int startMoney) {
- money=startMoney;
- }
- public AG_Account() {
- money = 0;
- }
- public void deposit(int amount) {
- money = money + amount;
- }
- public int withdraw (int amount) {
- if(money>=amount){
- this.money = money - amount;
- return amount;
- } else {
- int charge=35;
- overdraft(charge);
- }
- return 0;
- }
- public int getBalance(){
- return money;
- }
- private int overdraft(int charge){
- money = money - charge;
- return 0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement