diff --git a/src/garage/Garage.java b/src/garage/Garage.java index af77d99..41ff623 100644 --- a/src/garage/Garage.java +++ b/src/garage/Garage.java @@ -11,7 +11,7 @@ import veicoli.VeicoloAMotore; * @author Verde */ public class Garage { - public static final int DIMENSIONE_GARAGE = 2; + public static final int DIMENSIONE_GARAGE = 15; VeicoloAMotore[] veicoli = new VeicoloAMotore[DIMENSIONE_GARAGE]; public int immettiNuovoVeicolo(VeicoloAMotore v) throws ArrayIndexOutOfBoundsException { diff --git a/src/garage/MainGarage.java b/src/garage/MainGarage.java index 3e5f795..6e90e9a 100644 --- a/src/garage/MainGarage.java +++ b/src/garage/MainGarage.java @@ -83,8 +83,6 @@ public class MainGarage { SimpleDateFormat sdf = new SimpleDateFormat("yyyy"); Date annoImmatricolazioneDate; - String[] data; - String anno; boolean error; Date now = new Date(); String scelta; @@ -105,9 +103,7 @@ public class MainGarage { pausa(); error = true; } else { - data = annoImmatricolazioneDate.toString().split("\\s"); - anno = data[data.length - 1]; - annoImmatricolazione = Integer.parseInt(anno); + annoImmatricolazione = Integer.parseInt(sdf.format(annoImmatricolazioneDate)); } } catch (ParseException _) { System.out.println("Errore nella lettura della data.");