CSci 1101 Problem set 3. Due Thursday, March 6 at midnight

Question 1

In the voting program in the previous problem set print out the name of the winner. If it's a tie, print out both names and a message saying that they got equal number of votes.
Important: Copy your program from the previous problem set into a new file, do not change the original program.

Question 2

Recall the program hours.php that prints a greeting based on the time of the day (the lecture examples are posted here). Change the program so that, instead of printing the greeting, it prints out the time in the standard am/pm format. For instance, if the input is 13, the program should print 1pm. If the input is less than 0 or greater than 23, the program should print "Invalid time".

Question 3

Write a program that uses a loop to display a staircase shape: a sequence of one-row tables with a fixed background color, one right under the other, so that the width of the next row is 20 px longer than the width of the previous one.

Th eprogram takes a single input number_steps which is the number of steps in the "staircase".

Pick any color you want for the background of the table

Question 4

Write a program that creates a row of table cells with alternating colors (for instance, the first cell is blue, the second one is yellow, then blue again, etc.). The number of cells is taken as an input.

Question 5

Write a program that uses php function rand() to simulate a roll of 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.

Testing and submitting your code

To submit your programs, make sure that your current version is uploaded to rynite and send me an e-mail that lists all the file names and their locations and the names of program inputs.


This page is a part of CSci 1101 course web site.

The views and opinions expressed in this page are strictly those of the page author. The contents of this page have not been reviewed or approved by the University of Minnesota.