Miglioria UX
This commit is contained in:
@@ -233,34 +233,31 @@ public class MainGarage {
|
|||||||
int posizione = 0;
|
int posizione = 0;
|
||||||
VeicoloAMotore veicoloEstratto = null;
|
VeicoloAMotore veicoloEstratto = null;
|
||||||
|
|
||||||
|
error = false;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
error = false;
|
try {
|
||||||
|
System.out.print("Inserire la posizione: ");
|
||||||
|
posizione = sc.nextInt();
|
||||||
|
|
||||||
do {
|
if (posizione <= 0 || posizione >= Garage.DIMENSIONE_GARAGE) {
|
||||||
try {
|
System.out.println("Errore: la posizione non esiste.");
|
||||||
System.out.print("Inserire la posizione: ");
|
|
||||||
posizione = sc.nextInt();
|
|
||||||
|
|
||||||
if (posizione <= 0 || posizione >= Garage.DIMENSIONE_GARAGE) {
|
|
||||||
System.out.println("Errore: la posizione non esiste.");
|
|
||||||
pausa();
|
|
||||||
error = true;
|
|
||||||
}
|
|
||||||
} catch (InputMismatchException _) {
|
|
||||||
System.out.println("Errore nella lettura della posizione.");
|
|
||||||
pausa();
|
pausa();
|
||||||
error = true;
|
error = true;
|
||||||
}
|
}
|
||||||
} while (error);
|
} catch (InputMismatchException _) {
|
||||||
|
System.out.println("Errore nella lettura della posizione.");
|
||||||
veicoloEstratto = garage.estraiVeicolo(posizione);
|
|
||||||
if (veicoloEstratto != null) {
|
|
||||||
System.out.println(veicoloEstratto.toString());
|
|
||||||
} else {
|
|
||||||
System.out.println("Errore: la posizione indicata è vuota.");
|
|
||||||
pausa();
|
pausa();
|
||||||
error = true;
|
error = true;
|
||||||
}
|
}
|
||||||
} while (error);
|
} while (error);
|
||||||
|
|
||||||
|
veicoloEstratto = garage.estraiVeicolo(posizione);
|
||||||
|
if (veicoloEstratto != null) {
|
||||||
|
System.out.println("Veicolo estratto:");
|
||||||
|
System.out.println(veicoloEstratto.toString());
|
||||||
|
} else {
|
||||||
|
System.out.println("Errore: la posizione indicata è vuota.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user