Olá a todos,
preciso de ajuda nesse exercício do Use a Cabeça! Java
Colocaremos todas as suas novas aplicações em Java em uso como algo prático. Precisamos de uma classe com método main(), um tipo int e uma variável String, um loop while e teste IF. Mais alguns retoques e você estará construindo esse back-end empresarial sem demora. Mas antes examinará o código dessa rotina e pensará por um instante em você codificaria esse grande clássico, ?99 garrafas de cervejas?.
public class BeerSong {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
int beerNum = 99;
String word = "bottles";
while (beerNum > 0) {
if (beerNum == 1){
word = "bottle"; // no singular, uma Garrafa
}
System.out.println(beerNum + " " + word + " of beer on the wall") ;
System.out.println("Take one down.");
System.out.println("Pass it around");
if (beerNum > 0){
System.out.println(beerNum + " " + word + " of beer on the wall");
}else{
System.out.println("No more bottles of beer on the wall");
}
}
}
O código funciona tranquilo, so que tem um problema era pra marca de 99 bottles of beer on the wall até 1 bottles of beer on the wall, mas o compilador marca de 59 bottles of beer on the wall até 1 bottles of beer on the wall
Alguem tem idéia do que pode ser ou isso é normal do prompt de comando