Question: Objective is to write a Java program that prints the Bottle Song (99 bottles of beer on the wall 99 bottles of beer) 1. Ask
Objective is to write a Java program that prints the "Bottle Song" ("99 bottles of beer on the wall 99 bottles of beer")
1. Ask the user for a drink (hey...some of us don't drink beer you know...)
2. Ask for how many bottles are initially on the wall. You will start the song from that point down to zero.
3. print out the entire song. Make sure you change the lines when the count is 1 (bottles is no longer plural) and when its zero (this should be no bottles of at this point).
Requirements: use a while loop (or do/while loop). Also, to use a nested if or switch statement to change the wording as required above.
Example runs:
run: What is your favorite drink? wine
How many drinks? 2
...here we go!...
2 bottles of wine on the wall.
2 bottles of wine
Take one down. Pass it around.
1 bottle of wine on the wall.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1 bottle of wine on the wall.
1 bottle of wine
Take one down. Pass it around.
No bottles of wine on the wall.
Whewww... Thats way too much wine!
BUILD SUCCESSFUL (total time: 3 seconds)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
