Struttura base
This commit is contained in:
@@ -4,6 +4,8 @@
|
||||
*/
|
||||
package rettangoli_quadrati;
|
||||
|
||||
import java.util.Scanner;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Verde
|
||||
@@ -13,8 +15,54 @@ public class Rettangoli_Quadrati {
|
||||
/**
|
||||
* @param args the command line arguments
|
||||
*/
|
||||
|
||||
static Scanner sc = new Scanner(System.in);
|
||||
|
||||
public static void main(String[] args) {
|
||||
// TODO code application logic here
|
||||
}
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
package rettangoli_quadrati;
|
||||
|
||||
public class Rettangolo {
|
||||
private boolean isQuadrato;
|
||||
private double dimensioneUno, dimensioneDue;
|
||||
|
||||
public Rettangolo(double p_dimensioneUno, double p_dimensioneDue, boolean p_isQuadrato) {
|
||||
this.dimensioneUno = p_dimensioneUno;
|
||||
this.dimensioneDue = p_dimensioneDue;
|
||||
this.isQuadrato = p_isQuadrato;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user