Login Register






Thread Rating:
  • 0 Vote(s) - 0 Average


[I Just Started Recently Java][Any advice would be greatly appreciated.] filter_list
Author
Message
[I Just Started Recently Java][Any advice would be greatly appreciated.] #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.
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");
                
            }
            }
        }

Reply

RE: [I Just Started Recently Java][Any advice would be greatly appreciated.] #2
well i don't see what's the point of this!!

Code:
4 bottles of beer on the wall
4  bottles  of beer on the wall
4  bottles  of beer
Take one down.
Pass it around

u did want to have bottles of beer on the wall twice ? for every number ? or u did this by mistake ? i'm not sure what u was trying to do !!
[Image: blackeagle_zps6ad86521.gif]

Reply

RE: [I Just Started Recently Java][Any advice would be greatly appreciated.] #3
(10-19-2013, 12:40 AM)blackeagle Wrote: well i don't see what's the point of this!!

Code:
4 bottles of beer on the wall
4  bottles  of beer on the wall
4  bottles  of beer
Take one down.
Pass it around

u did want to have bottles of beer on the wall twice ? for every number ? or u did this by mistake ? i'm not sure what u was trying to do !!

Quote:4 bottles of beer on the wall
4 bottles of beer
Take one down.
Pass it around
3 bottles of beer on the wall

3 bottles of beer on the wall
3 bottles of beer
Take one down.
Pass it around
2 bottles of beer on the wall

This is how the song is sung, thus the double up is necessary. Although technically they are different "verses".

Reply

RE: [I Just Started Recently Java][Any advice would be greatly appreciated.] #4
I shall work on making it print out better, happy I posted the code on here I wiped my entire HDD and just installed ubuntu, starting with a fresh, non cluttered computer makes me feel better :3
I'm open to all advice, books, tutorials. I've taken a break the past two days, Just from a few days of programming I feel as if I look at every problem I face differently then I normally would.
Also, if anyone wants to Instant message me and help me out when I have problems (maybe even give me advice), I'd greatly appreciate it.
And another thing; I'm not completely drawn into java yet, I still have a small window before I can switch and do C++, would anyone reccomend I do that instead?

Reply

RE: [I Just Started Recently Java][Any advice would be greatly appreciated.] #5
@Geoff thanks for explaining !! but in his example at the 99 bottles it is said only once !!
[Image: blackeagle_zps6ad86521.gif]

Reply

RE: [I Just Started Recently Java][Any advice would be greatly appreciated.] #6
(10-19-2013, 09:28 AM)blackeagle Wrote: @Geoff thanks for explaining !! but in his example at the 99 bottles it is said only once !!

i never saw an example he provided... only the code.

Reply

RE: [I Just Started Recently Java][Any advice would be greatly appreciated.] #7
I don't see what's so funny here. That code is kind of trolling, as it appears. You said that you need advice but what kind of advice you need you need you haven't stated those. This code is a simple timepass. Do something productive as for an example you can code a simple song or poem generator, this will generate poems and songs based of stanzas or length stated by the user.

If you need reference likes books, links videos, then search the forum and don't expect someone to spoon feed you. I have myself posted many resources here on HC for learning java you just need to search for it.
[Image: OilyCostlyEwe.gif]

Reply

RE: [I Just Started Recently Java][Any advice would be greatly appreciated.] #8
I don't see what's so funny here. That code is kind of trolling, as it appears. You said that you need advice but what kind of advice you need you need you haven't stated those. This code is a simple timepass. Do something productive as for an example you can code a simple song or poem generator, this will generate poems and songs based of stanzas or length stated by the user.

If you need reference likes books, links videos, then search the forum and don't expect someone to spoon feed you. I have myself posted many resources here on HC for learning java you just need to search for it.
[Image: OilyCostlyEwe.gif]

Reply

RE: [I Just Started Recently Java][Any advice would be greatly appreciated.] #9
(10-19-2013, 11:30 AM)Psycho_Coder Wrote: I don't see what's so funny here. That code is kind of trolling, as it appears. You said that you need advice but what kind of advice you need you need you haven't stated those. This code is a simple timepass. Do something productive as for an example you can code a simple song or poem generator, this will generate poems and songs based of stanzas or length stated by the user.

If you need reference likes books, links videos, then search the forum and don't expect someone to spoon feed you. I have myself posted many resources here on HC for learning java you just need to search for it.

Are you on the right thread? im completely lost on what you are on about?

Reply

RE: [I Just Started Recently Java][Any advice would be greatly appreciated.] #10
(10-19-2013, 11:30 AM)Psycho_Coder Wrote: I don't see what's so funny here. That code is kind of trolling, as it appears. You said that you need advice but what kind of advice you need you need you haven't stated those. This code is a simple timepass. Do something productive as for an example you can code a simple song or poem generator, this will generate poems and songs based of stanzas or length stated by the user.

If you need reference likes books, links videos, then search the forum and don't expect someone to spoon feed you. I have myself posted many resources here on HC for learning java you just need to search for it.

Are you on the right thread? im completely lost on what you are on about?

Reply







Users browsing this thread: 1 Guest(s)