Solucion
Solucion
Solucion
Clase Operaciones
import java.util.Arrays;
Prueba de Amstrong
PRUEBA DE AMSTRONG
371: true
6578: false
1: true
Prueba de Fibonacci
i finonacci
1 [0]
2 [0, 1]
3 [0, 1, 1]
4 [0, 1, 1, 2]
5 [0, 1, 1, 2, 3]
Prueba de la Serie
i serie
1 1.0
2 1.5
3 1.8333333333333333
4 2.083333333333333
5 2.283333333333333
PROBLEMA 2
Clase ArregloService
import java.util.Arrays;
import java.util.Random;
public Service(int n) {
// Variables: Inicialización de los arreglos
arreglo1 = generarArregloAleatorio(n);
arreglo2 = generarArregloAleatorio(n);
}
Clase de Prueba
import java.util.Arrays;
// Variables
int[] arreglo1 = servicio.getArreglo1();
int[] arreglo2 = servicio.getArreglo2();
int[] diferencia = servicio.arregloDiferencia();
int[] interseccion = servicio.arregloInterseccion();
// Reporte
System.out.println("Arreglo 1: " + Arrays.toString(arreglo1));
System.out.println("Arreglo 2: " + Arrays.toString(arreglo2));
System.out.println("Arreglo Diferencia: " +
Arrays.toString(diferencia));
System.out.println("Arreglo Intersección: " +
Arrays.toString(interseccion));
}
}