This is the code to the Beer Song program, which has the job of reciting the entire "Beer Song" from 99 bottles to zero bottles. We were given the code, however there was one error which caused the song to say "1 bottles of beer on the wall" instead of the grammatically correct "1 bottle...". Thus, my task was to fix the code in order to make it grammatically sound. In order to achieve such a goal, I placed the "if (beerNum == 1)" chunk of code under the prints because now the code will notice that the number of beers left is 1, making it say bottle instead of bottles.
This is the PhraseOMatic program, which is meant to choose one random word from each of the three lists in order to say a phrase such as, "All we need is a John D Randolph". This is my favorite possible phrase because John D Randolph is my hero. In order to create the phrases, the program determines the number of words in each list and then chooses a random integer which represents the place value of the word in the list. Thus, it would choose the third, first, and fifth words in the first, second, and third list respectively.
No comments:
Post a Comment