Example #1
0
 public double totalNominas(Empleados[] empleados) {
   double total = 0.0;
   for (Empleados item : empleados) {
     total += item.salario();
   }
   return total;
 }
Example #2
0
 public void run() {
   String texto = "";
   while (repetir) {
     try {
       Empleados e = (Empleados) inObjeto.readObject();
       textarea1.setText("");
       textarea1.setForeground(Color.blue);
       if (e == null) {
         textarea1.setForeground(Color.red);
         PintaMensaje("<<EL EMPLEADO NO EXISTE>>");
       } else {
         texto =
             "Empleado: "
                 + e.getEmpNo()
                 + "\n   "
                 + "Oficio: "
                 + e.getOficio()
                 + "\tApellido: "
                 + e.getApellido()
                 + "\n    "
                 + "Comisión: "
                 + e.getComision()
                 + "\tDirección: "
                 + e.getDir()
                 + "\n    "
                 + "Alta: "
                 + e.getFechaAlt()
                 + "\tSalario: "
                 + e.getSalario()
                 + "\n    "
                 + "Departamento: "
                 + e.getDepartamentos().getDnombre();
         textarea1.append(texto);
       }
     } catch (SocketException s) {
       repetir = false;
     } catch (IOException e) {
       e.printStackTrace();
       repetir = false;
     } catch (ClassNotFoundException e) {
       e.printStackTrace();
       repetir = false;
     }
   }
   try {
     socket.close();
     System.exit(0);
   } catch (IOException e) {
     e.printStackTrace();
   }
 }