Open Source Software for Humanity: HW Week 6

[article] [edit page] [discussion] [history]

From Humanitarian-FOSS Project Development Site

Due Monday, 3/3

  • Read Chapter 10 of Learning PHP/MySQL (pages 199-215-) and answer questions 10.1-10.3 at the end of the chapter.

Due Wednesday, 3/5

  • Exercise 6-1. Write and test a PHP script that uses an HTML form to prompt the user for a number, representing a month (1 = Jan, 2 = Feb, ...) and displays how many days that month has. Use an array (as in last week's homework) to store the month names and number of days.
  • Exercise 6-2. Challenge: Revise the PHP script in the previous exercise so that it lets the user input both a month (as a number) and a year (as a number) and reports the number of days in that month in that year. The only month whose number of days changes in a leap year is February. The rule for leap years is: A year is a leap year if it is divisible by 4 unless it is also divisible by 100 unless its also divisible by 400. So 2008 (divisible by 4) is a leap year. 2000 is a leap year (divisible by 400). 1900 is not a leap year (divisible by 4 but by 100 and not 400).
Personal tools