Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a program that prints the first few verses of the traveling song One Hundred Bottles of Beer. Use a loop such that each prints
Write a program that prints the first few verses of the traveling song "One Hundred Bottles of Beer." Use a loop such that each prints one verse. Read the number of verses to print from the user. Validate the input The following are the first two verses of the so 100 bottles of beer on the wall 100 bottles of beer If one of those bottles should happen to fall 99 bottles of beer on the wall 99 bottles of beer on the wall 99 bottles of beer If one of those bottles should happen to fall 98 bottles of beer on the wall A scanner object for input A variable to store the number of verses Two loops: 1. One to perform input validation 2. The other to adjust the verses for each iteration Comments for appropriate documentation A sample of the output is shown below: How many verses (1 to 100)? -3 How many verses (1 to 100)? 3 100 bottles of beer on the wall. 100 bottles of beer. If one of those bottles should happen to fall 99 bottles of beer on the wall. 99 bottles of beer on the wall. 99 bottles of beer. If one of those bottles should happen to fall 98 bottles of beer on the wall. 98 bottles of beer on the wall. 98 bottles of beer. If one of those bottles should happen to fall
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started