Question: Using Java programming make a program that outputs the lyrics for Ninety-nine Bottles of Beer on the Wall. Your program should print the number of

Using Java programming

make a program that outputs the lyrics for "Ninety-nine Bottles of Beer on the Wall." Your program should print the number of bottles in English, not as a number. For example: Ninety-nine bottles of beer on the wall, Ninety-nine bottles of beer, Take one down, pass it around, Ninety-eight bottles of beer on the wall. ... One bottle of beer on the wall, One bottle of beer, Take one down, pass it around, Zero bottles of beer on the wall.

Your program should not use ninety-nine output statements! Design your program with a class namedBeerSongwhose constructor takes an integer parameter that is the number of bottles of beer initially on the wall. If the parameter is less than zero, set the number of bottles to zero. Similarly, if the parameter is greater than 99, set the number of beer bottles to 99. Then make a public method calledPrintSongthat outputs all stanzas from the number of bottles of beer down to zero. Add any additional private methods you find helpful.

HINT: Stanzas are all same, only a number of bottles is different. Use printf(...) method to form your stanzas.

You can see thelyrics for the song here.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!