Resta año actual con arreglo
Publicado por orlando Lino (1 intervención) el 24/09/2020 02:48:16
Buenas noches, necesito apoyo con el siguiente caso: Tengo un arreglo año de ingreso y otro arreglo código, requiero que mediante un método ingresando el código de un trabajador poder restar el año actual menos el año de ingreso, y esto me debe de arrojar como resultado la antigüedad, y la antigüedad multiplicarla por 3,
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
public class trabajo {
static String [] nombre = {"Pepito camotes", "Juancito papita", "juanete peque", "fido aguja", "Loro Loro"};
static String [] codigo = {"LA5753", "LA5352", "LA5133", "LA5513", "LA5755"};
static int [] aIngreso = {1996, 2001, 2000, 2015, 2018};
static String [] rank = {"CP", "FO", "CP", "FO", "CP"};
public static void main(String[] args){
Scanner ingreseDato = new Scanner(System.in);
int nuevoPuntaje = nuevoPuntaje;
calculoDePuntos(nuevoPuntaje, aIngreso);
System.out.println("Los puntos que tiene son: "+ nuevoPuntaje);
}
private static int calculoDePuntos(int nuevoPuntaje, int[] aIngreso){
int [] anioActual = {2020};
for(int i=0; i<aIngreso.length; i++){
nuevoPuntaje = anioActual[0] - aIngreso[i];
}
return nuevoPuntaje;
}
}
Valora esta pregunta


0