71 lines
2.0 KiB
Java
71 lines
2.0 KiB
Java
/*
|
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Main.java to edit this template
|
|
*/
|
|
package eserciziogarage;
|
|
|
|
import java.util.Scanner;
|
|
|
|
/**
|
|
*
|
|
* @author Verde
|
|
*/
|
|
public class EsercizioGarage {
|
|
|
|
/**
|
|
* @param args the command line arguments
|
|
*/
|
|
|
|
static Scanner sc = new Scanner(System.in);
|
|
|
|
public static void main(String[] args) {
|
|
int DIMENSIONE_GARAGE = 3;
|
|
Garage garage = new Garage(DIMENSIONE_GARAGE);
|
|
int scelta;
|
|
|
|
do {
|
|
System.out.println("Scegliere un'opzione:");
|
|
System.out.println("1. Ingresso auto");
|
|
System.out.println("2. Stampa posti occupati");
|
|
System.out.println("3. Stampa posti liberi");
|
|
System.out.println("4. Uscita auto");
|
|
System.out.println("0. Esci");
|
|
System.out.print("Opzione: ");
|
|
|
|
scelta = sc.nextInt();
|
|
sc.nextLine();
|
|
|
|
switch (scelta) {
|
|
case 0:
|
|
break;
|
|
case 1:
|
|
System.out.println(garage.IngressoAuto());
|
|
Pausa();
|
|
break;
|
|
case 2:
|
|
System.out.println(garage.GetPostiOccupati());
|
|
Pausa();
|
|
break;
|
|
case 3:
|
|
System.out.println(garage.GetPostiLiberi());
|
|
Pausa();
|
|
break;
|
|
case 4:
|
|
System.out.println(garage.UscitaAuto());
|
|
Pausa();
|
|
break;
|
|
default:
|
|
System.out.println("Opzione non valida.");
|
|
Pausa();
|
|
break;
|
|
|
|
}
|
|
} while (scelta != 0);
|
|
}
|
|
|
|
public static void Pausa() {
|
|
System.out.println("Premere un tasto per continuare. . .");
|
|
sc.nextLine();
|
|
}
|
|
}
|