Advertisement
piffy

Codice senza test (Legacy)

Jul 29th, 2018
375
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.24 KB | None | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package javalegacy;
  7.  
  8. /**
  9.  *
  10.  * @author piffy
  11.  */
  12. public class Account {
  13.  
  14.     private boolean status;
  15.     private String nome;
  16.     private String PIN;
  17.     private Double soldi;
  18.  
  19.     public Double getSoldi() {
  20.         return soldi;
  21.     }
  22.  
  23.     public void setSoldi(Double soldi) {
  24.         this.soldi = soldi;
  25.     }
  26.  
  27.     public Account() {
  28.         status = false;
  29.         nome = "";
  30.         PIN = "0000";
  31.         soldi = 0.0;
  32.     }
  33.  
  34.     public Account(boolean status, String nome, String PIN, Double soldi) {
  35.         this.status = status;
  36.         this.nome = nome;
  37.         this.PIN = PIN;
  38.     }
  39.  
  40.     /** Tenta un prelievo. Se ci sono soldi sufficienti li toglie dal conto **/
  41.     public double prelievo(Double euro) {
  42.         if (this.soldi-euro>0)
  43.         {this.soldi -= euro; return euro;}
  44.         if (this.soldi>0)
  45.         {euro=this.soldi; this.soldi=0.0;return euro;}
  46.         return 0;
  47.     }
  48.    
  49.     /** Versa soldi nel conto **/
  50.     public void versamento(Double euro) {
  51.        this.soldi+=euro;
  52.     }
  53.        
  54.        
  55.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement