Beer Song(I checked the forums for previous posts)

Hi everyone, I've already checked the forums for the beer song flaw. There's a flaw according to the book Head First Java. Please check if I did it right. I can't seem to spot the flaw or I think I did correct it.
The actual code

What I did:

I have run them both, the only change I noticed was that the extra line vanished and I think what I did is correct, please help.

99 bottles of beer on the wall
99 bottles of beer
take one down
pass it around
98 bottles of beer on the wall

98 bottles of beer on the wall
98 bottles of beer
... and so on ...

Down to
1 bottle of beer on the wall
1 bottle of beer
take one down
pass it around
no more bottles of beer on the wall

Is this what you get?

S Kanth

Greenhorn

Posts: 7

posted 5 years ago

What I get is like this

99 bottles of beer on the wall
99 bottles of beer.
Take one down.
Pass it around.
98 bottles of beer on the wall
98 bottles of beer.
Take one down.
Pass it around.
......so on
.....
1 bottle of beer on the wall
1 bottle of beer.
Take one down.
Pass it around.
No more bottles of beer on the wall

99 bottles of beer on the wall
99 bottles of beer
take one down
pass it around
98 bottles of beer on the wall

98 bottles of beer on the wall
98 bottles of beer

Meaning that I should get "98 bottles of beer on the wall", that line twice for whatever the number is?

S Kanth wrote: Meaning that I should get "98 bottles of beer on the wall", that line twice for whatever the number is?

I don't know what the assignment says, but each verse of the actual song, as I learned it, is

So, according to that, yes, you would see all the non-fencepost numbers with "...bottles of beer on the wall" twice in a row--once at the end of a verse as N - 1, and immediately after that at the beginning of the next verse as the new N.

S Kanth

Greenhorn

Posts: 7

posted 5 years ago

This is the code, the output I'm getting at the last lines as

1 bottles of beer on the wall
1 bottle of beer on the wall
1 bottle of beer.
Take one down.
Pass it around.
No more bottles of beer on the wall

Take a look at that AJ, I am getting the output correct for all except for the last lines where in I'm getting

2 bottles of beer on the wall
2 bottles of beer.
Take one down.
Pass it around.
1 bottles of beer on the wall -----> that's the one part where it should be bottle and not bottles, you can't move in place of the greater than sign. Please check once again.