Opzione 2
This commit is contained in:
@@ -43,6 +43,10 @@ public class ContoCorrente {
|
||||
return numeroContoCorrente;
|
||||
}
|
||||
|
||||
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.");
|
||||
|
||||
@@ -44,7 +44,7 @@ public class MyBank {
|
||||
do {
|
||||
System.out.println("Scegliere un'opzione:");
|
||||
System.out.println("1. Aprire conto corrente");
|
||||
System.out.println("2. ");
|
||||
System.out.println("2. Versamento");
|
||||
System.out.println("3. Prelievo");
|
||||
System.out.println("4. ");
|
||||
System.out.println("0. Esci");
|
||||
@@ -66,7 +66,7 @@ public class MyBank {
|
||||
if (conti.isEmpty()) {
|
||||
System.out.println(ERRORE_CONTI_VUOTO);
|
||||
} else {
|
||||
|
||||
versa(conti);
|
||||
}
|
||||
pausa();
|
||||
break;
|
||||
@@ -246,6 +246,10 @@ public class MyBank {
|
||||
}
|
||||
}
|
||||
|
||||
static void versa(ArrayList<ContoCorrente> conti) {
|
||||
selezionaConto(conti).versa(quantita("da versare"));
|
||||
}
|
||||
|
||||
static void preleva(ArrayList<ContoCorrente> conti) {
|
||||
boolean error;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user