1
while(resposta == "sim"){
System.out.println("Informe o Numero do Produto desejado");
System.out.println("15 - Parafuso, 20 - Porca, 30 - Arruela");
cod_peca = scn.nextInt();
switch(cod_peca){
case 15:
System.out.println("Voce selecionou Parafuso");
break;
case 20:
System.out.println("Voce selecionou Porca");
break;
case 30:
System.out.println("Voce selecionou Arruela");
break;
}
System.out.println("Informe a Quantidade do Produto");
qtdeProd = scn.nextInt();
}
System.out.println("Numero do Produto comprado: "+cod_peca);
What specific problem are you encountering? Try to be a little more specific about what’s not working, and how I wish it was working
– Isac
I’m sorry, I came in here today and I’m posting here for the first time. Half lost still kkk anyway, I am to read 3 products and that the person select only the products selected and that print it. I do not know, the option would be to switch case or if Else. could give me a help?
– user90625
Possible duplicate of Unexecuted entry
– Sorack
One thing is that comparison of
String
is done withequals
:"sim".equals(resposta)
– Sorack
vlw guys! It worked
– user90625