Se formatea utils

This commit is contained in:
2024-10-25 14:05:49 +02:00
parent 7615c0ff64
commit fe7325620e
2 changed files with 27 additions and 7 deletions

28
.idea/workspace.xml generated
View File

@@ -4,11 +4,7 @@
<option name="autoReloadType" value="SELECTIVE" /> <option name="autoReloadType" value="SELECTIVE" />
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="e2c4f742-461e-4c7a-a6e0-b5f4b8e8f229" name="Changes" comment="Ejercicio E terminado"> <list default="true" id="e2c4f742-461e-4c7a-a6e0-b5f4b8e8f229" name="Changes" comment="utils y resto" />
<change afterPath="$PROJECT_DIR$/src/main/java/examenes/examen20241025/Ejercicio_a.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/examenes/examen20241025/utils/Utils.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/examenes/examen20241025/utils/Utils.java" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" /> <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
@@ -118,7 +114,23 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1729855840536</updated> <updated>1729855840536</updated>
</task> </task>
<option name="localTasksCounter" value="8" /> <task id="LOCAL-00008" summary="Ejercicio A terminado">
<option name="closed" value="true" />
<created>1729857807569</created>
<option name="number" value="00008" />
<option name="presentableId" value="LOCAL-00008" />
<option name="project" value="LOCAL" />
<updated>1729857807569</updated>
</task>
<task id="LOCAL-00009" summary="utils y resto">
<option name="closed" value="true" />
<created>1729857821078</created>
<option name="number" value="00009" />
<option name="presentableId" value="LOCAL-00009" />
<option name="project" value="LOCAL" />
<updated>1729857821078</updated>
</task>
<option name="localTasksCounter" value="10" />
<servers /> <servers />
</component> </component>
<component name="VcsManagerConfiguration"> <component name="VcsManagerConfiguration">
@@ -129,6 +141,8 @@
<MESSAGE value="Ejercicio B terminado" /> <MESSAGE value="Ejercicio B terminado" />
<MESSAGE value="Ejercicio B comentado" /> <MESSAGE value="Ejercicio B comentado" />
<MESSAGE value="Ejercicio E terminado" /> <MESSAGE value="Ejercicio E terminado" />
<option name="LAST_COMMIT_MESSAGE" value="Ejercicio E terminado" /> <MESSAGE value="Ejercicio A terminado" />
<MESSAGE value="utils y resto" />
<option name="LAST_COMMIT_MESSAGE" value="utils y resto" />
</component> </component>
</project> </project>

View File

@@ -8,19 +8,23 @@ public class Utils {
Scanner sc = new Scanner(System.in); Scanner sc = new Scanner(System.in);
return sc.nextInt(); return sc.nextInt();
} }
public static String solicitarStringScanner(String pregunta) { public static String solicitarStringScanner(String pregunta) {
System.out.println(pregunta); System.out.println(pregunta);
Scanner sc = new Scanner(System.in); Scanner sc = new Scanner(System.in);
return sc.nextLine(); return sc.nextLine();
} }
public static double generarNumAleatorio(int multiplicador) { public static double generarNumAleatorio(int multiplicador) {
return Math.random() * multiplicador; return Math.random() * multiplicador;
} }
public static void mostrarArrayNums(int array[]) { public static void mostrarArrayNums(int array[]) {
for (int num : array) { for (int num : array) {
System.out.print(num + " "); System.out.print(num + " ");
} }
} }
public static int[] crearArrayNumsAleatorios(int cantidadElementos, int numMinimo, int numMaximo) { public static int[] crearArrayNumsAleatorios(int cantidadElementos, int numMinimo, int numMaximo) {
int[] nums = new int[cantidadElementos]; int[] nums = new int[cantidadElementos];
@@ -29,6 +33,7 @@ public class Utils {
} }
return nums; return nums;
} }
public static int calcularFactorial(int num) { public static int calcularFactorial(int num) {
int factorial = 1; int factorial = 1;
@@ -38,6 +43,7 @@ public class Utils {
} }
return factorial; return factorial;
} }
public static int[] ordenarBurbuja(int[] array) { public static int[] ordenarBurbuja(int[] array) {
boolean ordenando; boolean ordenando;
do { do {