Controlli
This commit is contained in:
@@ -28,6 +28,8 @@ public class GestioneFerie {
|
||||
|
||||
static Scanner sc = new Scanner(System.in);
|
||||
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";
|
||||
|
||||
public static void main(String[] args) {
|
||||
@@ -58,23 +60,44 @@ public class GestioneFerie {
|
||||
pausa();
|
||||
break;
|
||||
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("La richiesta è attualmente in attesa di approvazione.");
|
||||
}
|
||||
pausa();
|
||||
break;
|
||||
case 3:
|
||||
approvaRichiesteFerie(dipendenti, richieste);
|
||||
if (richieste.isEmpty()) {
|
||||
System.out.println(ERRORE_RICHIESTE_VUOTO);
|
||||
} else {
|
||||
approvaRichiesteFerie(dipendenti, richieste);
|
||||
}
|
||||
pausa();
|
||||
break;
|
||||
case 4:
|
||||
System.out.println(
|
||||
"Giorni di ferie residui: " + getDipendente(dipendenti).getGiorniFerieResidui());
|
||||
if (dipendenti.isEmpty()) {
|
||||
System.out.println(ERRORE_DIPENDENTI_VUOTO);
|
||||
} else {
|
||||
System.out.println(
|
||||
"Giorni di ferie residui: " + getDipendente(dipendenti).getGiorniFerieResidui());
|
||||
}
|
||||
pausa();
|
||||
break;
|
||||
case 5:
|
||||
mostraDipendentiInFerie(
|
||||
data("per cui visualizzare i dipendenti in ferie"), dipendenti, richieste);
|
||||
if (dipendenti.isEmpty()) {
|
||||
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();
|
||||
break;
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user