-
Lenguaje
Java usando Scanner
-
Descripción
Solicite el sueldo y los años de antigüedad de varios trabajadores. El programa debe informar:
a) Si el sueldo es inferior a 450 000 y su antigüedad es igual o superior a 10 años, otorgarle un aumento del 20 %, mostrar el sueldo con el aumento a pagar.
b) Si el sueldo es inferior a 450 000 pero su antigüedad es menor a 10 años, otorgarle un aumento de 5 %, mostrar el sueldo con el aumento a pagar.
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
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
import java.util.Scanner;
public class AumentoPorSueldoYAntiguedad {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
double antiguedad, aumento, sueldo, sueldo_a_pagar;
String tecla_repetir;
do {
System.out.print("Ingresa el valor de antiguedad: ");
antiguedad = in.nextDouble();
in.nextLine();
System.out.print("Ingresa el valor de sueldo: ");
sueldo = in.nextDouble();
in.nextLine();
aumento=0;
if(sueldo<450000&&antiguedad>=10)
aumento=sueldo*0.20;
if(sueldo<450000&&antiguedad<10)
aumento=sueldo*0.05;
sueldo_a_pagar=sueldo+aumento;
System.out.println("Valor de aumento: " + aumento);
System.out.println("Valor de sueldo a pagar: " + sueldo_a_pagar);
System.out.println();
do {
System.out.print("\u00BFDeseas repetir el proceso? (S/N): ");
tecla_repetir = in.nextLine();
} while (!tecla_repetir.equalsIgnoreCase("s") && !tecla_repetir.equalsIgnoreCase("n"));
} while (tecla_repetir.equalsIgnoreCase("s"));
}
}
public class AumentoPorSueldoYAntiguedad {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
double antiguedad, aumento, sueldo, sueldo_a_pagar;
String tecla_repetir;
do {
System.out.print("Ingresa el valor de antiguedad: ");
antiguedad = in.nextDouble();
in.nextLine();
System.out.print("Ingresa el valor de sueldo: ");
sueldo = in.nextDouble();
in.nextLine();
aumento=0;
if(sueldo<450000&&antiguedad>=10)
aumento=sueldo*0.20;
if(sueldo<450000&&antiguedad<10)
aumento=sueldo*0.05;
sueldo_a_pagar=sueldo+aumento;
System.out.println("Valor de aumento: " + aumento);
System.out.println("Valor de sueldo a pagar: " + sueldo_a_pagar);
System.out.println();
do {
System.out.print("\u00BFDeseas repetir el proceso? (S/N): ");
tecla_repetir = in.nextLine();
} while (!tecla_repetir.equalsIgnoreCase("s") && !tecla_repetir.equalsIgnoreCase("n"));
} while (tecla_repetir.equalsIgnoreCase("s"));
}
}