piffy icon

Codice senza test (Legacy)

piffy | PRO | 07/29/18 05:44:21 PM UTC | 0 ⭐ | 693 👁️ | Never ⏰ | []
Java |

1.24 KB

|

None

|

0 👍

/

0 👎

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package javalegacy;
 
/**
 *
 * @author piffy
 */
public class Account {
 
    private boolean status;
    private String nome;
    private String PIN;
    private Double soldi;
 
    public Double getSoldi() {
        return soldi;
    }
 
    public void setSoldi(Double soldi) {
        this.soldi = soldi;
    }
 
    public Account() {
        status = false;
        nome = "";
        PIN = "0000";
        soldi = 0.0;
    }
 
    public Account(boolean status, String nome, String PIN, Double soldi) {
        this.status = status;
        this.nome = nome;
        this.PIN = PIN;
    }
 
    /** Tenta un prelievo. Se ci sono soldi sufficienti li toglie dal conto **/
    public double prelievo(Double euro) {
        if (this.soldi-euro>0)
        {this.soldi -= euro; return euro;}
        if (this.soldi>0)
        {euro=this.soldi; this.soldi=0.0;return euro;}
        return 0;
    }
    
    /** Versa soldi nel conto **/
    public void versamento(Double euro) {
       this.soldi+=euro;
    }
        
        
    }

Comments