Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- System.out.println(liquidacion.consultaDepartamento(numeroDepto));
- public void insertaEmpleado(int numero, Empleado empleado) {
- plantilla.put(numero, empleado);
- }
- public String consultaDepartamento(int numero) {
- String mensaje = "LIQUIDACION POR DEPARTAMENTOn";
- double acumulador = 0.0;//acumular la liquidacion
- boolean encontrado = false;
- Set<Integer> numeros = plantilla.keySet();
- Iterator<Integer> it = numeros.iterator();
- while (it.hasNext()) {
- Integer num = it.next();
- if (plantilla.get(num).getDepartamento().getNumeroDepartamento() == numero) {
- acumulador += plantilla.get(num).calcularLiquidacion();
- mensaje += plantilla.get(num).toString();
- encontrado = true;
- }
- }
- if (encontrado) {
- return mensaje.toString() + "nFIN DE LISTADO DEPARTAMENTO";
- } else {
- return String.format("No existe el departamento introducido");
- }
- }
Add Comment
Please, Sign In to add comment