-
Lenguaje
Java usando Scanner
-
Descripción
Se les dará un bono por antigüedad a los empleados de una tienda. Si tiene 5 años, se les dará $1000; si tienen más de 5 y menos de 10 años $2000. Para los que tengan 10 o más, el bono será de $3000. Determinar el bono que recibirá un trabajador.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import java.util.Scanner;
public class BonoPorAntiguedadDe5O10Anos {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int antiguedad, bono;
System.out.print("Ingresa el valor de antiguedad: ");
antiguedad = in.nextInt();
in.nextLine();
bono=0;
if(antiguedad==5)
bono=1000;
if(antiguedad>5&&antiguedad<10)
bono=2000;
if(antiguedad>=10)
bono=3000;
System.out.println("Valor de bono: " + bono);
}
}
public class BonoPorAntiguedadDe5O10Anos {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int antiguedad, bono;
System.out.print("Ingresa el valor de antiguedad: ");
antiguedad = in.nextInt();
in.nextLine();
bono=0;
if(antiguedad==5)
bono=1000;
if(antiguedad>5&&antiguedad<10)
bono=2000;
if(antiguedad>=10)
bono=3000;
System.out.println("Valor de bono: " + bono);
}
}