Computing a Baby Sitter's Pay


A baby sitter charges $1.50 per hour until 9:00 pm (while the kids are still up), $1.00 per hour between 9:00 pm and midnight, and $1.25 per hour after midnight (since late night baby sitting interferes with morning classes).

Write a Web-based script that has four integer parameters (the sitter's starting time in hours and minutes and the ending time in hours and minutes) and computes the sitter's fee. Assume all times are between 6:00 pm and 6:00 am, and hours should be entered as being between 0 and 12 (inclusive). Hours outside the range of 0 to 12 should be considered invalid. In addition,

The following table may clarify allowed time values for this problem.

Starting Starting Ending Ending StartingEnding
Hour Minutes Hour Minutes Time time
8 0 3 30 8:00pm 3:30am
6 0 0 45 6:00pm 12:45am
12 0 6 0 12:00am (midnight) 6:00am

Input via an HTML Form

Hours Minutes
Starting Time:
Ending Time: