Lab 6, Part 4 ------------- This is the one about converting kg to stones and pounds. It was marked out of 3. If you did not get 3 out of 3, here's possible reasons why... a) If your had a compile-time or run-time error, you scored zero. b) Did you forget to convert the user's input from strings to numbers? Specifically, since a person's weight need not be a whole number of kg, your program should convert to float, not int: \$weight_kg = (float) \$_GET['weight_kg']; c) Did you get the calculation wrong? The lab sheet said: "First, convert the user's weight in kg to just pounds. Hint: A kilogram is 2.2 pounds. So if the user enters 60kg, then we have 132 pounds." So that's easy: \$weight_pounds = \$weight_kg * 2.2; Then the lab sheet said: "Now convert pounds to stones. Hint: A stone is 14 pounds. So if the user is 132 pounds, then s/he weighs 9.428571429 stone, which you round down to 9 stone." Also easy: \$stones = (int) (\$weight_pounds / 14); Lastly, the lab sheet said: "And finally separate the pounds (e.g. 132) into stones (which we worked out just now: 9 lots of 14) and the remaining pounds (6)." There are two ways to do this: \$pounds = (int) (\$weight_pounds - (\$stones * 14)); - in which case, don't forget the (int), so that the answer is rounded down, which is what the lab sheet asked for. Or instead, you could have: \$pounds = \$weight_pounds % 14; The nice thing about using % is that it gives an integer, so we don't need (int). On the other hand, many students incorrectly wrote \$pounds = \$weight_pounds % \$stones; which divides by the wrong thing. d) Did you fail to present the output as a paragraph? It needed

and

tags - because that's what the lab sheet asked for. Lab 6, Part 5 ------------- This is the one about American cash in your pocket. It was marked out of 7. If you did not get 7 out of 7, here's possible reasons why... cash.html (the form) - Did your form fail to validate? Apart from all the usual reasons (forgetting to close a div, for example), the most commons errors included the following: (a) the value of the 'for' attribute in the 'label' must match the value of the 'id' attribute in the 'input' element; (b) the values of 'id' attributes, as you know, must be unique. One of you had several
s - confusing s with