[I Just Started Recently Java][Any advice would be greatly appreciated.] 10-17-2013, 05:21 AM
#1
99 Bottles of beer; One of my first programs. I'm lacking motivation to keep moving foward so if anyone wants to help each other track their progress within learning java, I'd be willing to help.
If your going to say I could make this program better or cleaner please post your view on how to do so it would be very much appreciated.
If your going to say I could make this program better or cleaner please post your view on how to do so it would be very much appreciated.
Code:
public class BeerSong {
public static void main (String[] args) {
int beerNum = 99;
String word = " bottles ";
while (beerNum > 0) {
if (beerNum == 1) {
word = "bottle"; //Singular word, ONE Bottle.
}
// "" + word = Bottles; String Word * Stoned at the moment.
System.out.println(beerNum + " " + word + " of beer on the wall ");
System.out.println(beerNum + " " + word + " of beer ");
System.out.println("Take one down.");
System.out.println("Pass it around");
beerNum = beerNum - 1;
if (beerNum > 1) {
System.out.println(beerNum + "" + word + "of beer on the wall");
}
}
{
System.out.println("No more bottles of beer on the wall");
}
}
}