Open Ed232005 opened 1 month ago
public void rand(int[] vectorprop){ for(int i=0; i<vectorprop.length; i++){ vectorprop[i]=(int)(Math.random()*100+1); System.out.println(vectorprop[i]); }
public void ordenar(){
for(int i= 0; i<vectorprop.length; i++){
for(int o= 0; o<vectorprop.length; o++){
if(vectorprop[i]>vectorprop[o]){
int temporal=vectorprop[i];
vectorprop[i]=vectorprop[o];
vectorprop[o]=temporal;
}
}
}
}
}
public class mainclass{ public static void main(String[] args) { int[] array = {5, 10, 15}; Vector vector_a = new Vector(array); vector_a.im(array);
} ublic class Vector{ int[] vectorprop = new int[5]; public Vector(int[] vectorprop){ this.vectorprop=vectorprop; } public void setvectorprop(int[] vectorprop){ this.vectorprop=vectorprop; } public void im(int[] vectorprop){ for(int i=0; i<vectorprop.length; i++){ System.out.println(vectorprop[i]); } }
}