Question: Write a PHP program asg4.php that will display a form asking for four parameters: Convert F to C or C to F in a drop

Write a PHP program asg4.php that will display a form asking for four parameters:

  • Convert F to C or C to F in a drop down list.
  • the starting Fahrenheit/Celsius degree
  • the ending Fahrenheit/Celsius degree
  • the increment in Fahrenheit/Celsius

On the Fahrenheit temperature scale, water freezes at 32 degrees and boils at 212 degrees. On the Celsius scale, water freezes at 0 degrees and boils at 100 degrees. If you want to convert from Fahrenheit to Celsius, you subtract 32 from the temperature, multiply by 5, and divide by 9. To convert from Celsius to Fahrenheit, you multiply by 9, divide by 5, and then add 32.

Then the program asg4.php will call itself. That is, the action part of the form is the same file name. The PHP program file name can be changed and yet you do not need to change the source code.

Upon the second entry of the program asg4.php, it will print out a table of Fahrenheit and Celsius temperature equivalents from starting degrees to ending degrees with increment degree.

For example, if your drop down list is F to C and input starting value = 0; ending value = 100 and increment = 5 the output will be similar to the one shown above. You may use floating point instead of integer and the display can be 0.0 instead of 0. That is the display is similar and not necessarily totally identical.

To format the output nicely, you should use

.

Do not use spaces or tab to do the format as the browser will treat multiple spaces as a single space.

Write a PHP program asg4.php that will display a form asking for

DX #Temperature Conversion - Netsc... File Edit View Go Communicator Help Back Forward Reload Home Sean Bookmarks Location: Lab1-Q4.php Temperature Conversion Fahreheit Celsius 0 -17.777777777778 6 10 - 12.222222222222 15 -9.4444444444444 20 -6.6666666666667 25 -3.8888888888889 30 - 1.1111111111111 1.6666666666667 40 4.4444444444444 46 7.2222222222222 50 10 66 12.777777777778 60 15.555555556660 18.333333333333 70 21.111111111111 76 23.888888888889 80 26.666666666667 29.444444444444 90 32.222222222222 95 35 100 37.777777777778 85

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!