Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package edu.ua.cs.cs200.lab10;
- public class Atm {
- private double balance;
- public double get_balance() {
- return balance;
- }
- /*
- * This class is licensed with GPL.
- */
- public void initialBalance(double startingBalance) {
- this.balance = startingBalance;
- }
- /** Class allows user to deposit money into account.
- * @param amount is amount of money to add to account
- * @return true if amount is not equal to 0.
- */
- public boolean deposit(double amount) {
- if (amount < 0) {
- return false;
- }
- this.balance += amount;
- return true;
- }
- /** Class allows user to withdraw money if funds are available.
- * @param amount is amount to withdraw
- * @return true if funds are available, otherwise false
- */
- public boolean withdraw(double amount) {
- if (amount < 0) {
- return false;
- }
- if (this.balance < amount) {
- return false;
- }
- this.balance -= amount;
- return true;
- }
- public void doNothing() {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement