Change the program so that it correctly handles one bottle of beer. It should re
ID: 3621114 • Letter: C
Question
Change the program so that it correctly handles one bottle of beer. It should read 1 bottle of beer on the wall. and not 1 bottles of beer.// Variables
var count; // numeric
// Main Program
count = parseFloat(prompt(“How many bottles?”,0));
while ((count > 0))
{
document.write(count);
document.writeln(“ bottles of beer on the wall,”);
document.write(count);
document.writeln((“ bottles of beer,”);
document.write(“Take one down. pass it around);
count = count - 1
document.write(count);
document.writeln(“ bottles of beer on the wall,”);
document.writeln(“ “);
}
Explanation / Answer
Dear.. var count; // numeric // Main Program count = parseFloat(prompt("How many bottles?",0)); while ((count > 1)) { document.writeln(count ," bottles of beer on the wall,"); document.writeln(count ," bottles of beer,"); document.write("Take one down. pass it around
"); count = count - 1 document.writeln(" "); } if(count
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.