if (pin.isEmpty()) {
showError("Please enter a PIN.");
+ txtPin.setText("");
+ txtEmployees.setText("");
return;
}
if (employees.isEmpty()) {
showError("Please enter the available amount of employees.");
+ txtPin.setText("");
+ txtEmployees.setText("");
return;
}
availableEmployees = Short.parseShort(employees);
} catch (NumberFormatException ex) {
showError("Please enter a valid amount of employees.");
+ txtPin.setText("");
+ txtEmployees.setText("");
return;
}
int totalEmployees = Main.getTotalNumberOfEmployees();
if (availableEmployees >= totalEmployees) {
showError("Please enter an amount of employees that is less than the total number of employees.");
+ txtPin.setText("");
+ txtEmployees.setText("");
return;
}
if (availableEmployees <= 0) {
showError("The amount of employees must be greater than 0.");
+ txtPin.setText("");
+ txtEmployees.setText("");
return;
}
boolean ok = Main.isPINCorrect(pin);
if (!ok) {
showError("PIN is incorrect. Access denied.");
+ txtPin.setText("");
+ txtEmployees.setText("");
+ return;
}
} catch (IOException ex) {
showError("Error trying to check the PIN: " + ex.getMessage());
FuelStation[] possibleFuelStations = Main.getFuelStationListWhenUnderstaffed(availableEmployees);
if (possibleFuelStations.length == 0) {
appendOutput("No fuel stations can function with the available amount of employees.");
+ txtPin.setText("");
+ txtEmployees.setText("");
return;
}