The Temperature Assignment

For this assignment, you will use some of the skills picked up in our last class.


What I'd like you to do is to programmatically create a celsius/Fahrenheit conversion table, which will ultimately look somewhat like the following:

0 degrees F is equivalent to - 17.7 C, which is cold
1 degrees F is equivalent to -17.2 C, which is cold
76 degrees F is equivalent to  22.2 C, which is nice
100 degrees F is equivalent to 37.77 C, which is hot

It should have AT LEAST 100 lines/entries and should have at least 3 "gradations" of temperature (hot, cold, warm, nice, etc) -- the names and amount are up to you, though they should be reasonable.

Decimal accuracy should be at least to the 10th for C. The following conversion format is fine:

F to C - Subtract 32, multiply by 5/9
C to F, Multiply by 9/5, add 32

To break it down, you'll need to think about the following tasks:

1) How to do math

2) How to do a finite loop, incrementing numbers

3) How to select an english description based on number input.

Implement this in php — call the file "temp-a.php" and put in your main html folder.


Using CSS, apply color to each of your 3+ gradations accordingly; make "hot" red, "cold" blue, etc. Whether background, text, or something else is up to you. Call this file "temp-b.php" and put in your main html folder.


Give each line its OWN color (slightly different from the one before and after) to create a smooth gradient per line, ranging from blue for cold to red for hot (what goes in the middle is up to you, just please ensure that the endpoints are as stated)

For this part, you'll have to go back to the different forms of CSS coloring. Obviously word-based color names will not do the trick here; you'll have to consider the various ways colors can be presented (RGB vs. HSL, hexadecimal vs percentages, etc.) and figure out one that works well for you. Call this file "temp-c.php" and put in your main html folder.

Good Luck!


(doh, the Fahrenheit degrees got cut off a bit, but you get the idea...