commit a592b71c91934ae4bcb7292475a79edd20870611 Author: h4ckx0r Date: Fri Oct 25 12:34:10 2024 +0200 Commit inicial diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5ff6309 --- /dev/null +++ b/.gitignore @@ -0,0 +1,38 @@ +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ + +### IntelliJ IDEA ### +.idea/modules.xml +.idea/jarRepositories.xml +.idea/compiler.xml +.idea/libraries/ +*.iws +*.iml +*.ipr + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..f1895cf --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,14 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000..8ec03f0 --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1729851488897 + + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..44b0dc3 --- /dev/null +++ b/pom.xml @@ -0,0 +1,17 @@ + + + 4.0.0 + + net.h4ckx0r + ExamenesProgramacion + 1.0-SNAPSHOT + + + 23 + 23 + UTF-8 + + + \ No newline at end of file diff --git a/src/main/java/examenes/examen20241025/utils/Utils.java b/src/main/java/examenes/examen20241025/utils/Utils.java new file mode 100644 index 0000000..e16851e --- /dev/null +++ b/src/main/java/examenes/examen20241025/utils/Utils.java @@ -0,0 +1,41 @@ +package examenes.examen20241025.utils; + +import java.util.Scanner; + +public class Utils { + public static int solicitarIntScanner(String pregunta) { + System.out.println(pregunta); + Scanner sc = new Scanner(System.in); + return sc.nextInt(); + } + public static String solicitarStringScanner(String pregunta) { + System.out.println(pregunta); + Scanner sc = new Scanner(System.in); + return sc.nextLine(); + } + public static double generarNumAleatorio(int multiplicador) { + return Math.random() * multiplicador; + } + public static void mostrarArrayNums(int array[]) { + for (int num : array) { + System.out.print(num + " "); + } + } + public static int[] crearArrayNumsAleatorios(int cantidadElementos, int numMinimo, int numMaximo) { + int[] nums = new int[cantidadElementos]; + + for (int i = 0; i < nums.length; i++) { + nums[i] = numMinimo + (int) Math.round(generarNumAleatorio((numMaximo - numMinimo))); + } + return nums; + } + public static int calcularFactorial(int num) { + int factorial = 1; + + while (num >= 1) { + factorial *= num; + num--; + } + return factorial; + } +} \ No newline at end of file