Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * 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;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement