Java - JAVA Ayuda Bonificación

 
Vista:
sin imagen de perfil
Val: 66
Ha mantenido su posición en Java (en relación al último mes)
Gráfica de Java

JAVA Ayuda Bonificación

Publicado por Osvaldo (60 intervenciones) el 14/10/2020 22:49:06
¿Como están todos? Deseo la ayuda de ustedes para poder pulir mi código. Por favor.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/* Elaborar un programa que permita al operador ingresar los siguientes datos, correspondientes a los empleados de una empresa.
Código de Empleado (ENTER p/finaliza)
Antigüedad (>0)
Sueldo (>= 500000 y <= 5000000)
Hacer un proceso que permita calcular e imprimir el Código y el IMPORTE DE BONIFICACIÓN, para cada empleado cuya antigüedad
sea superior a 4. El Importe de Bonificación se calcula aplicándole un porcentaje del 2% al Sueldo por cada 3 años de Antigüedad.
Al final del proceso imprimir el Código del empleado que tiene el Mayor Importe de Bonificación, junto al importe
Bonificación que le corresponde, además de la cantidad de empleados que fueron beneficiados y el monto total de las
bonificaciones.
Ejemplos: Si ha trabajado 7 años, el Porcentaje para la bonificación es 4%
Si ha trabajado 11 años, el Porcentaje para la bonificación es 6%
Si ha trabajado 5 años, el Porcentaje para la bonificación es 2%. */
package bonificacion;
import java.util.Scanner;
public class Bonificacion {
        public static void main(String[] args) {
            Scanner sc = new Scanner(System.in);
            int CodEmpleado =0;
            int Antiguedad =0;
            int Sueldo =0;
            double Bonificacion =0.0;
            int Importe =0;
            int MayorImporte =0;
            int Cantidad_Beneficiados =0;
            int MontoTotal =0;
                        while (CodEmpleado != 0){
               if ( Antiguedad >0) {
                   if (Sueldo  >= 500000 && Sueldo <= 5000000) {
                       if (Antiguedad  >4) {
                           CodEmpleado = sc.nextInt();
                           Antiguedad = sc.nextInt();
                           Sueldo = sc.nextInt();
                           Bonificacion = sc.nextDouble();
                           Importe = sc.nextInt();
                           MayorImporte = sc.nextInt();
                           Cantidad_Beneficiados = sc.nextInt();
                           MontoTotal = sc.nextInt();
                           Cantidad_Beneficiados = (Cantidad_Beneficiados + 1);
                       }
                       if (Antiguedad == 5) {
                           Bonificacion = (Bonificacion * 0.02);
                            }
                  else {
                        if (Antiguedad == 7) {
                            Bonificacion = (Bonificacion * 0.04);
                        }
                        else {
                            if (Antiguedad ==11) {
                                Bonificacion = (Bonificacion * 0.06);
                            }
                            MontoTotal = (MontoTotal + Importe);
                        }
                             if (Bonificacion  > MayorImporte);
                             System.out.print("Mayor Importe:"  +MayorImporte);
                             System.out.print("Importe Correspondiente:" +Importe);
                             System.out.print("Cantidad Empleados Beneficiados:" +Cantidad_Beneficiados);
                             System.out.print("Monto Total de Bonificaciones:" +MontoTotal);
                       }
                   }
                                                    }
                    }
 
    }
}
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
Imágen de perfil de Rodrigo
Val: 2.041
Plata
Ha mantenido su posición en Java (en relación al último mes)
Gráfica de Java

JAVA Ayuda Bonificación

Publicado por Rodrigo (623 intervenciones) el 15/10/2020 01:09:57
Usa el boton </> Codigo al publicar para no perder la indentacion.
Tal como esta no invita a leerlo y me nubla ver el resto.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
sin imagen de perfil
Val: 66
Ha mantenido su posición en Java (en relación al último mes)
Gráfica de Java

JAVA Ayuda Bonificación

Publicado por Osvaldo (60 intervenciones) el 17/10/2020 21:15:13
Perfecto. Espero haber logrado la indentación del código. Espero su ayuda y de todos. Muchas Gracias.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package bonificacion;
 
import java.util.Scanner;
 
public class Bonificacion {
 
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int CodEmpleado = 0;
        int Antiguedad = 0;
        int Sueldo = 0;
        double Bonificacion = 0.0;
        int Importe = 0;
        int MayorImporte = 0;
        int Cantidad_Beneficiados = 0;
        int MontoTotal = 0;
        while (CodEmpleado != 0) {
            if (Antiguedad > 0) {
                if (Sueldo >= 500000 && Sueldo <= 5000000) {
                    if (Antiguedad > 4) {
                        CodEmpleado = sc.nextInt();
                        Antiguedad = sc.nextInt();
                        Sueldo = sc.nextInt();
                        Bonificacion = sc.nextDouble();
                        Importe = sc.nextInt();
                        MayorImporte = sc.nextInt();
                        Cantidad_Beneficiados = sc.nextInt();
                        MontoTotal = sc.nextInt();
                        Cantidad_Beneficiados = (Cantidad_Beneficiados + 1);
                    }
                    if (Antiguedad == 5) {
                        Bonificacion = (Bonificacion * 0.02);
                    } else {
                        if (Antiguedad == 7) {
                            Bonificacion = (Bonificacion * 0.04);
                        } else {
                            if (Antiguedad == 11) {
                                Bonificacion = (Bonificacion * 0.06);
                            }
                            MontoTotal = (MontoTotal + Importe);
                        }
                        if (Bonificacion > MayorImporte);
                        System.out.print("Mayor Importe:" + MayorImporte);
                        System.out.print("Importe Correspondiente:" + Importe);
                        System.out.print("Cantidad Empleados Beneficiados:" + Cantidad_Beneficiados);
                        System.out.print("Monto Total de Bonificaciones:" + MontoTotal);
                    }
                }
            }
        }
 
    }
}
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
sin imagen de perfil
Val: 66
Ha mantenido su posición en Java (en relación al último mes)
Gráfica de Java

JAVA Ayuda Bonificación

Publicado por Osvaldo (60 intervenciones) el 23/10/2020 22:25:46
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package bonificacion;
 
import java.util.Scanner;
 
public class Bonificacion {
 
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int CodEmpleado = 0;
        int Antiguedad = 0;
        int Sueldo = 0;
        double Bonificacion = 0.0;
        int Importe = 0;
        int MayorImporte = 0;
        int Cantidad_Beneficiados = 0;
        int MontoTotal = 0;
        while (CodEmpleado != 0) {
            if (Antiguedad > 0) {
                if (Sueldo >= 500000 && Sueldo <= 5000000) {
                    if (Antiguedad > 4) {
                        CodEmpleado = sc.nextInt();
                        Antiguedad = sc.nextInt();
                        Sueldo = sc.nextInt();
                        Bonificacion = sc.nextDouble();
                        Importe = sc.nextInt();
                        MayorImporte = sc.nextInt();
                        Cantidad_Beneficiados = sc.nextInt();
                        MontoTotal = sc.nextInt();
                        Cantidad_Beneficiados = (Cantidad_Beneficiados + 1);
                    }
                    if (Antiguedad == 5) {
                        Bonificacion = (Bonificacion * 0.02);
                    } else {
                        if (Antiguedad == 7) {
                            Bonificacion = (Bonificacion * 0.04);
                        } else {
                            if (Antiguedad == 11) {
                                Bonificacion = (Bonificacion * 0.06);
                            }
                            MontoTotal = (MontoTotal + Importe);
                        }
                        if (Bonificacion > MayorImporte);
                        System.out.print("Mayor Importe:" + MayorImporte);
                        System.out.print("Importe Correspondiente:" + Importe);
                        System.out.print("Cantidad Empleados Beneficiados:" + Cantidad_Beneficiados);
                        System.out.print("Monto Total de Bonificaciones:" + MontoTotal);
                    }
                }
            }
        }
 
    }
}
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar