Work in groups of two.
Fix the time issue in cascading if/else exercise: make sure that it prints an error message for invalid times, i.e. $hour < 0 and $hour > 23.
Do the exercise on conditionals: at the end of this page.
Write a program that uses php function rand() to simulate a roll of a
six-sided die. Write a loop to find 5 random rolls, print them out,
add them all together by keeping a running total, and display the sum.
Some hints: start by writing a loop to repeat the roll of a die 5
times. In the loop store the die value in a variable and print out the
variable. Once you get this to work, think of how you would find the
sum. You need an extra variable to accumulate the sum. Think of what
that variable should be before the loop and how it changes in the
loop.
Just save the two files on csci1101sp09 or, if using remote access, upload them to csci1101sp09. Send me an e-mail when done. Both group partners should be on CC list for this.
This page is a part of CSci 1101 course web site.