Controlli
This commit is contained in:
@@ -28,6 +28,8 @@ public class GestioneFerie {
|
|||||||
|
|
||||||
static Scanner sc = new Scanner(System.in);
|
static Scanner sc = new Scanner(System.in);
|
||||||
static final String ERRORE_GENERICO = "Errore: opzione non valida.";
|
static final String ERRORE_GENERICO = "Errore: opzione non valida.";
|
||||||
|
static final String ERRORE_DIPENDENTI_VUOTO = "È necessario inserire almeno un dipendente prima di proseguire.";
|
||||||
|
static final String ERRORE_RICHIESTE_VUOTO = "Aggiungere almeno una richiesta prima di proseguire.";
|
||||||
static final String FORMATO_DATA = "dd/MM/yyyy";
|
static final String FORMATO_DATA = "dd/MM/yyyy";
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
@@ -58,23 +60,44 @@ public class GestioneFerie {
|
|||||||
pausa();
|
pausa();
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
richiediFerie(richieste, dipendenti);
|
if (dipendenti.isEmpty()) {
|
||||||
|
System.out.println(ERRORE_DIPENDENTI_VUOTO);
|
||||||
|
} else {
|
||||||
|
richiediFerie(richieste, dipendenti);
|
||||||
System.out.println("Richiesta di ferie aggiunta con successo.");
|
System.out.println("Richiesta di ferie aggiunta con successo.");
|
||||||
System.out.println("La richiesta è attualmente in attesa di approvazione.");
|
System.out.println("La richiesta è attualmente in attesa di approvazione.");
|
||||||
|
}
|
||||||
pausa();
|
pausa();
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
approvaRichiesteFerie(dipendenti, richieste);
|
if (richieste.isEmpty()) {
|
||||||
|
System.out.println(ERRORE_RICHIESTE_VUOTO);
|
||||||
|
} else {
|
||||||
|
approvaRichiesteFerie(dipendenti, richieste);
|
||||||
|
}
|
||||||
pausa();
|
pausa();
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
System.out.println(
|
if (dipendenti.isEmpty()) {
|
||||||
"Giorni di ferie residui: " + getDipendente(dipendenti).getGiorniFerieResidui());
|
System.out.println(ERRORE_DIPENDENTI_VUOTO);
|
||||||
|
} else {
|
||||||
|
System.out.println(
|
||||||
|
"Giorni di ferie residui: " + getDipendente(dipendenti).getGiorniFerieResidui());
|
||||||
|
}
|
||||||
pausa();
|
pausa();
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
mostraDipendentiInFerie(
|
if (dipendenti.isEmpty()) {
|
||||||
data("per cui visualizzare i dipendenti in ferie"), dipendenti, richieste);
|
System.out.println(ERRORE_DIPENDENTI_VUOTO);
|
||||||
|
} else {
|
||||||
|
if (richieste.isEmpty()) {
|
||||||
|
System.out.println(ERRORE_RICHIESTE_VUOTO);
|
||||||
|
} else {
|
||||||
|
mostraDipendentiInFerie(
|
||||||
|
data("per cui visualizzare i dipendenti in ferie"), dipendenti, richieste);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pausa();
|
pausa();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
Reference in New Issue
Block a user