Versamento
This commit is contained in:
@@ -4,10 +4,38 @@
|
||||
*/
|
||||
package guimybank;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Verde
|
||||
*/
|
||||
public class ContoCorrente {
|
||||
private String nome;
|
||||
private String cognome;
|
||||
private String codiceFiscale;
|
||||
private double saldo;
|
||||
private int numeroContoCorrente;
|
||||
//private Date dataDiNascita;
|
||||
|
||||
public ContoCorrente(String nome, String cognome, String codiceFiscale, /*Date dataDiNascita,*/ double saldo) {
|
||||
this.nome = nome;
|
||||
this.cognome = cognome;
|
||||
this.codiceFiscale = codiceFiscale;
|
||||
//this.dataDiNascita = dataDiNascita;
|
||||
this.saldo = saldo;
|
||||
}
|
||||
|
||||
public void versa(double quantita){
|
||||
this.saldo += quantita;
|
||||
}
|
||||
|
||||
public void preleva(double quantita) throws IllegalArgumentException{
|
||||
if (quantita > this.saldo) {
|
||||
throw new IllegalArgumentException("La quantità desiderata eccede il saldo corrente.");
|
||||
}
|
||||
else {
|
||||
this.saldo -= quantita;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user