Write a program that simulates five rolls of a 6-sided die using a random
number generator. Print out the
result of each roll and find the sum of all rolls (hint: you will need
a variable sum
that is set to zero before the loop, keep
adding the results to that variable, and print it after the loop).
Write afunction that prints out one verse of the song 10 bottles of beer on the wall. The function takes one number as a parameter For instance, if you pass 5 as a parameter, it would print
5 bottles of beer on the wall, 5 bottles of beer. Take one down and pass it around, 4 bottles of beer on the wall.Use a loop to call the function to print out the entire song starting at 10 bottles.
A good way of approaching the problem is:
Ex. 11 p. 153. Include a printout, a photocopy, or a scan of each of the two algorithms, mark parts of it that you think are unclear and parts that you think are clear, briefly explain why.
Send all of your program files to me by e-mail. You may submit the written part in class or send it together with your problem set. Please send only ONE e-mail with your entire submission, make sure you include everything. Multiple e-mails with your homework may result in lower grade.
Your programs will be graded not just on correctness, but also on the clarity of code. Appearance of the page and creativity may be taken into account.