Migliorata data

This commit is contained in:
La Programmatrice Verde
2025-10-28 13:22:30 +01:00
parent cda2a97d02
commit 262f581394
2 changed files with 2 additions and 6 deletions

View File

@@ -11,7 +11,7 @@ import veicoli.VeicoloAMotore;
* @author Verde * @author Verde
*/ */
public class Garage { public class Garage {
public static final int DIMENSIONE_GARAGE = 2; public static final int DIMENSIONE_GARAGE = 15;
VeicoloAMotore[] veicoli = new VeicoloAMotore[DIMENSIONE_GARAGE]; VeicoloAMotore[] veicoli = new VeicoloAMotore[DIMENSIONE_GARAGE];
public int immettiNuovoVeicolo(VeicoloAMotore v) throws ArrayIndexOutOfBoundsException { public int immettiNuovoVeicolo(VeicoloAMotore v) throws ArrayIndexOutOfBoundsException {

View File

@@ -83,8 +83,6 @@ public class MainGarage {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy");
Date annoImmatricolazioneDate; Date annoImmatricolazioneDate;
String[] data;
String anno;
boolean error; boolean error;
Date now = new Date(); Date now = new Date();
String scelta; String scelta;
@@ -105,9 +103,7 @@ public class MainGarage {
pausa(); pausa();
error = true; error = true;
} else { } else {
data = annoImmatricolazioneDate.toString().split("\\s"); annoImmatricolazione = Integer.parseInt(sdf.format(annoImmatricolazioneDate));
anno = data[data.length - 1];
annoImmatricolazione = Integer.parseInt(anno);
} }
} catch (ParseException _) { } catch (ParseException _) {
System.out.println("Errore nella lettura della data."); System.out.println("Errore nella lettura della data.");