Skip to content
This repository has been archived by the owner on Aug 9, 2024. It is now read-only.

Commit

Permalink
Arreglar detalles sobre mtd de opción 3
Browse files Browse the repository at this point in the history
  • Loading branch information
Laifsyn committed Apr 12, 2024
1 parent a7fe7ea commit 53aeeb2
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/main/java/com/utp/clsHerramientas/pry1/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public void mtdMediaValor() {
ciclo_parejas: while (true) {
String[] str_pareja = Cli
.read_non_empty_input(
"Ingrese dos numeros separados con un coma. Ingrese 999 para imprimir el resultado.")
"Ingrese dos numeros separados con un coma. Ingrese 999 para proseguir a imprimir el resultado.")
.split(",", 2);
if (str_pareja.length != 2) {
System.out.println("Debe ingresar dos números separados por coma.");
Expand All @@ -145,6 +145,9 @@ public void mtdMediaValor() {
System.out.println("`" + entry + "` No es convertible a número.");
continue ciclo_parejas;
}
if (maybe_num.get() == 999) {
break ciclo_parejas;
}
pareja[i] = maybe_num.get();
}
var insertable = new BigDecimal((pareja[0] + pareja[1]) / 2.0);
Expand All @@ -156,10 +159,6 @@ public void mtdMediaValor() {
media_mayor = Optional.of(insertable);
}
}
// Romper del ciclo si el segundo numero es 999
if (pareja[1] == 999) {
break;
}
}
if (media_mayor.isEmpty()) {
throw new RuntimeException("Es imposible que no se hayan ingresado parejas.");
Expand Down

0 comments on commit 53aeeb2

Please sign in to comment.