Mrgentledolphin

conto

Oct 12th, 2017
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.61 KB | None | 0 0
  1. public class Conto {
  2.      
  3.     private double amount;
  4.     private String owner;
  5.      
  6.     // costruttore
  7.     public Conto(String owner, double initialAmount) {
  8.         this.owner = owner;
  9.         this.amount = initialAmount;
  10.     }
  11.  
  12.     public void versamento(double qty) {
  13.         amount += qty;
  14.     }
  15.  
  16.     public boolean prelievo(double qty) {
  17.         if(amount < qty)
  18.             return false;
  19.         amount -= qty;
  20.         return true;
  21.     }
  22.      
  23.     public double getAmount() {
  24.         return amount;
  25.     }
  26.  
  27.     public String getOwner() {
  28.         return owner;
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment