// Allison Obourn, CSE 142 // A bank account object which has a balance that can be changed // by deposits and withdrawals. public class BankAccount { private double balance; private int transactionNumber; private String owner; private int accountNumber; // Constructs a bank acount with a given balance, name and number public BankAccount(double startingBalance, String name, int number) { balance = startingBalance; owner = name; accountNumber = number; transactionNumber = 0; } // Returnsthe balance public double getBalance() { return balance; } // Withdraws money from the bank account. Fails if the balance is less // than the money to withdraw public void withdraw(double money) { if (balance >= money) { balance -= money; } } // Deposits money into the bank account. Fails if amount is negative. public void deposit(double money) { if (money > 0) { balance += money; } } }