lunes, 21 de marzo de 2011

Empleado - salario

Logica ---> Empleado.
Presentacion ---> Formulario.

Descarga... click acá
Logica --->Empleado
  •  /*
     * To change this template, choose Tools | Templates
     * and open the template in the editor.
     */

    package Logica;

    /*
     *
     * @author Danimortal
     */
    public class Empleado {

        long idEmp, salEmp;
        String nomEmp;
        int hed,hen,hedf,henf;

        public double calcularNomina()
        {

            double salario = 0,menos = 0, suma = 0, valorhora;

            valorhora = ((salEmp /30)/8);
            //Descuento salud:
            menos =  menos + (salEmp*0.004);
            //Descuento pension:
            menos =  menos + (salEmp*0.003);
            //Subsidio de transporte:
            if (salEmp < 1060000)
            {
                suma = suma + 61500 ;
            }
            //Hora extra diurna
            suma = suma + (hed*(valorhora*0.025));
            //Hora extra nocturna
            suma = suma + (hen*(valorhora*0.035));
            //Hora extra Diurna festiva
            suma = suma + (hedf*valorhora);
            //Hora Nocturna  Festiva
            suma = suma + (henf*(valorhora*1.5));

                    salario = salEmp + suma;
                    salario = salario - menos;

            return (salario);

        }

        public int getHed() {
            return hed;
        }

        public void setHed(int hed) {
            this.hed = hed;
        }

        public int getHedf() {
            return hedf;
        }

        public void setHedf(int hedf) {
            this.hedf = hedf;
        }

        public int getHen() {
            return hen;
        }

        public void setHen(int hen) {
            this.hen = hen;
        }

        public int getHenf() {
            return henf;
        }

        public void setHenf(int henf) {
            this.henf = henf;
        }

        public long getIdEmp() {
            return idEmp;
        }

        public void setIdEmp(long idEmp) {
            this.idEmp = idEmp;
        }

        public String getNomEmp() {
            return nomEmp;
        }

        public void setNomEmp(String nomEmp) {
            this.nomEmp = nomEmp;
        }

        public long getSalEmp() {
            return salEmp;
        }

        public void setSalEmp(long salEmp) {
            this.salEmp = salEmp;
        }



    }
Presentacion --->Formulario

  • /*
     * To change this template, choose Tools | Templates
     * and open the template in the editor.
     */

    package Presentacion;

    import Logica.Empleado;
    import java.io.*;

    /**
     *
     * @author Danimortal
     */
    public class Formulario {

    public static String leer() throws IOException
        {
        InputStreamReader entrada = new InputStreamReader (System.in) ;
        BufferedReader lectura= new BufferedReader(entrada);
        String cadena=lectura.readLine();
        return((cadena));
        }

    public static void main(String arg[]) throws IOException
        {

        Empleado obj1 = new Empleado();

        System.out.println("DIGITE LA INFORMACION DEL EMPLEADO:");
        System.out.println("Cedula:");obj1.setIdEmp(Long.parseLong(leer()));
        System.out.println("Nombre:");obj1.setNomEmp(leer());
        System.out.println("Salario:");obj1.setSalEmp(Integer.parseInt(leer()));
        System.out.println("Horas Extras Diurnas:");obj1.setHed(Integer.parseInt(leer()));
        System.out.println("Horas Extras nocturnas:");obj1.setHen(Integer.parseInt(leer()));
        System.out.println("Horas Extras Diurnas Festivos:");obj1.setHedf(Integer.parseInt(leer()));
        System.out.println("Horas Extras nocturnas Festivos:");obj1.setHenf(Integer.parseInt(leer()));

        System.out.println("El salario neto del empleado es:" + obj1.calcularNomina());

        }
    }

No hay comentarios:

Publicar un comentario