Ejercicios Capitulo 5 bloque 3
This commit is contained in:
@@ -8,6 +8,7 @@ public class Utils {
|
||||
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);
|
||||
@@ -19,6 +20,7 @@ public class Utils {
|
||||
Scanner sc = new Scanner(System.in);
|
||||
return sc.nextInt();
|
||||
}
|
||||
|
||||
public static String solicitarStringScannerInline(String pregunta) {
|
||||
System.out.print(pregunta);
|
||||
Scanner sc = new Scanner(System.in);
|
||||
@@ -26,12 +28,12 @@ public class Utils {
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static float solicitarFloatScanner(String pregunta) {
|
||||
System.out.println(pregunta);
|
||||
Scanner sc = new Scanner(System.in);
|
||||
return sc.nextFloat();
|
||||
}
|
||||
|
||||
public static float solicitarFloatScannerInline(String pregunta) {
|
||||
System.out.print(pregunta);
|
||||
Scanner sc = new Scanner(System.in);
|
||||
@@ -42,11 +44,16 @@ public class Utils {
|
||||
return Math.random() * multiplicador;
|
||||
}
|
||||
|
||||
public static int generarIntAleatorioEntreLimites(int limiteMin, int limiteMax) {
|
||||
return limiteMin + ((int) Math.round(Math.random() * (limiteMax - limiteMin)));
|
||||
}
|
||||
|
||||
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];
|
||||
|
||||
@@ -55,6 +62,7 @@ public class Utils {
|
||||
}
|
||||
return nums;
|
||||
}
|
||||
|
||||
public static int[] crearArrayNumsAleatoriosSinRepeticiones(int cantidadElementos, int numMinimo, int numMaximo) {
|
||||
int[] nums = new int[cantidadElementos];
|
||||
|
||||
@@ -75,6 +83,7 @@ public class Utils {
|
||||
}
|
||||
return nums;
|
||||
}
|
||||
|
||||
public static String cambiarAMinuscula(String textoACambiar) {
|
||||
String minuscula = "";
|
||||
for (int i = 0; i < textoACambiar.length(); i++) {
|
||||
|
||||
Reference in New Issue
Block a user