-
Lenguaje
Java usando Scanner
-
Descripción
Se les dará un bono por antigüedad a los empleados de una tienda. Si tienen un año, se les dará $100; si tienen 2 años, $200, y así sucesivamente hasta los 5 años. Para los que tengan más de 5, el bono será de $1000. Realice un programa que permita 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
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import java.util.Scanner;
public class BonoPorAntiguedadDe5Anos {
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();
if(antiguedad<=5)
bono=antiguedad*100;
else
bono=1000;
System.out.println("Valor de bono: " + bono);
}
}
public class BonoPorAntiguedadDe5Anos {
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();
if(antiguedad<=5)
bono=antiguedad*100;
else
bono=1000;
System.out.println("Valor de bono: " + bono);
}
}