Advertisement
Guest User

Account.java

a guest
Feb 19th, 2022
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.65 KB | None | 0 0
  1. /*
  2.      * DO NOT TOUCH THIS !
  3.      */
  4.      
  5.     public class Account {
  6.      
  7.         private double balance;
  8.         private String owner;
  9.      
  10.         public Account(String owner, double balance) {
  11.             this.balance = balance;
  12.             this.owner = owner;
  13.         }
  14.      
  15.         public void deposit(double amount) {
  16.             this.balance = this.balance + amount;
  17.         }
  18.      
  19.         public void withdrawal(double amount) {
  20.             this.balance = this.balance - amount;
  21.         }
  22.      
  23.         public double balance() {
  24.             return this.balance;
  25.         }
  26.      
  27.         @Override
  28.         public String toString() {
  29.             return this.owner + " balance: " + this.balance;
  30.         }
  31.     }
  32.      
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement