Prelievo (quello prima era versamento)
This commit is contained in:
@@ -61,15 +61,6 @@ public class MyBank {
|
||||
switch (scelta) {
|
||||
case 0:
|
||||
break;
|
||||
case 2:
|
||||
if (conti.isEmpty()) {
|
||||
System.out.println(ERRORE_CONTI_VUOTO);
|
||||
} else {
|
||||
versa(conti);
|
||||
System.out.println("Versamento effettuato con successo.");
|
||||
}
|
||||
pausa();
|
||||
break;
|
||||
case 3:
|
||||
if (conti.isEmpty()) {
|
||||
System.out.println(ERRORE_CONTI_VUOTO);
|
||||
@@ -203,53 +194,6 @@ public class MyBank {
|
||||
}
|
||||
}
|
||||
|
||||
static void versa(ArrayList<ContoCorrente> conti) {
|
||||
selezionaConto(conti).versa(quantita("da versare"));
|
||||
}
|
||||
|
||||
static void preleva(ArrayList<ContoCorrente> conti) {
|
||||
boolean error;
|
||||
|
||||
do {
|
||||
error = false;
|
||||
try {
|
||||
selezionaConto(conti).preleva(quantita("da prelevare"));
|
||||
} catch (IllegalArgumentException e) {
|
||||
System.out.println(e.getMessage());
|
||||
pausa();
|
||||
error = true;
|
||||
}
|
||||
} while (error);
|
||||
|
||||
}
|
||||
|
||||
static ContoCorrente selezionaConto(ArrayList<ContoCorrente> conti) {
|
||||
ContoCorrente contoCorrente = null;
|
||||
int numeroContoCorrente;
|
||||
boolean error;
|
||||
|
||||
do {
|
||||
error = false;
|
||||
System.out.print("Inserire il proprio numero di conto: ");
|
||||
numeroContoCorrente = sc.nextInt();
|
||||
sc.nextLine();
|
||||
|
||||
if (!ContoCorrente.getNumeriContiCorrenti().contains(numeroContoCorrente)) {
|
||||
System.out.println("Errore: il conto corrente specificato non esiste.");
|
||||
pausa();
|
||||
error = true;
|
||||
} else {
|
||||
for (ContoCorrente conto : conti) {
|
||||
if (conto.getNumeroContoCorrente() == numeroContoCorrente) {
|
||||
contoCorrente = conto;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} while (error);
|
||||
return contoCorrente;
|
||||
}
|
||||
|
||||
static void stampaLog(ArrayList<ContoCorrente> conti) {
|
||||
try (BufferedReader br = new BufferedReader(
|
||||
new FileReader(PATH_CONTI + "movimenti_" + selezionaConto(conti).getNumeroContoCorrente() + ".txt"))) {
|
||||
|
||||
Reference in New Issue
Block a user