You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by "Marco Robiati (Jira)" <ji...@apache.org> on 2021/04/21 12:55:00 UTC

[jira] [Commented] (NETBEANS-5603) el programa se bloquea al ejecutar un dowhile

    [ https://issues.apache.org/jira/browse/NETBEANS-5603?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17326509#comment-17326509 ] 

Marco Robiati commented on NETBEANS-5603:
-----------------------------------------

Hi, I'm not sure if it's written somewhere but, I think you should use english, as it's usually considered the default language to use when there are people from different languages, that would get your report higher chances of being reviewed, not everybody speaks spanish :D

> el programa se bloquea al ejecutar un dowhile 
> ----------------------------------------------
>
>                 Key: NETBEANS-5603
>                 URL: https://issues.apache.org/jira/browse/NETBEANS-5603
>             Project: NetBeans
>          Issue Type: Bug
>         Environment: import java.util.*;
> public class CalculadoraElemental {
>     public static void main(String args[]) {
>         char opcion;
>         Scanner sc = new Scanner(System.in);
>         System.out.println("PROGRAMA CALCULADORA");
>        do{
>            System.out.println("pulse Intro para empezar:");
>            do{
>                 System.out.print("Selecciona un operacion ");
>                 System.out.print("+,-,*,/ (0) para terminar");
>                 String texto= sc.nextLine();
>                 opcion= (texto.length()>0)?texto.charAt(0): '0';
>               }while("+-*/0".indexOf(opcion)<0);
>             if(opcion!='0'){
>                 System.out.println("\nIntroduce un numero");
>                 double n1 = Double.parseDouble(sc.nextLine());
>                 System.out.println("\nIntroduce otro numero");
>                 double n2 = Double.parseDouble(sc.nextLine());
>                 switch (opcion) {
>                     case '+':
>                         System.out.printf("%5.2f+%5.2f=%5.2f\n", n1,n2,n1+n2);
>                         break;
>                     case'-':
>                         System.out.printf("%5.2f-%5.2f=%5.2f\n", n1,n2,n1-n2);
>                         break;
>                     case'*':
>                         System.out.printf("%5.2f*%5.2f=%5.2f\n", n1,n2,n1*n2);
>                         break;
>                     case '/':
>                         if (n2>0)
>                         System.out.printf("%5.2f/%5.2f=%5.2f\n", n1,n2,n1/n2);
>                         break;
>                 } 
>             }
>         }while(opcion!='0');
>         System.out.println("\n Fin del Programa");
>     }
> }
>            Reporter: Lorenzo 
>            Priority: Minor
>         Attachments: Incidencia Netbeans_190421.docx
>
>
> Estoy empezando con la programación Java pero al usar NetBeans por desarollar un programa de prueba expuesto en un libro e programa no sale como debería.
> He utilizado el mismo código en BlueJ y funciona perfectamente como debería.
>  
> En NetBeans cuando llega a Bucle do while parece que no consigue avanzar y ejecutar un simple System.out.print("......") seguido de otro System.out.print("......") . Al darle intro 3 veces el programa repite dos veces o tres el System.out.print("......") 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists