How to resolve the algorithm 99 bottles of beer step by step in the Plain English programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm 99 bottles of beer step by step in the Plain English programming language

Table of Contents

Problem Statement

Display the complete lyrics for the song:     99 Bottles of Beer on the Wall.

The lyrics follow this form: ... and so on, until reaching   0     (zero). Grammatical support for   1 bottle of beer   is optional. As with any puzzle, try to do it in as creative/concise/comical a way as possible (simple, obvious solutions allowed, too).

Let's start with the solution:

Step by Step solution about How to resolve the algorithm 99 bottles of beer step by step in the Plain English programming language

Source code in the plain programming language

To run:
Start up.
Sing 99 of bottles of beer on the wall.
Wait for the escape key.
Shut down.

To sing a number of bottles of beer on the wall:
Put the number into a counter.
Loop.
Write the first line given the counter.
Write the second line given the counter.
Write "Take one down, pass it around" to the console.
Subtract 1 from the counter.
Write the first line given the counter.
If the counter is 0, break.
Write "" on the console.
Repeat.

To write the first line given a counter:
If the counter is 0, write "No more bottles of beer on the wall" to the console; exit.
If the counter is 1, write "1 bottle of beer on the wall" to the console; exit.
Write the counter then " bottles of beer on the wall" to the console.

To write the second line given a counter:
If the counter is 1, write "1 bottle of beer" to the console; exit.
Write the counter then " bottles of beer" to the console.

  

You may also check:How to resolve the algorithm Arithmetic/Integer step by step in the Plain English programming language
You may also check:How to resolve the algorithm Split a character string based on change of character step by step in the Plain English programming language
You may also check:How to resolve the algorithm Array concatenation step by step in the Plain English programming language
You may also check:How to resolve the algorithm Generic swap step by step in the Plain English programming language
You may also check:How to resolve the algorithm Gapful numbers step by step in the Plain English programming language