Hi I need help with php programming assignment Convert between yards and meters
ID: 3670326 • Letter: H
Question
Hi I need help with php programming assignment
Convert between yards and meters depending on which button is clicked. Your program must contain 2 functions, one that converts from yards to meters and the other that converts from meters to yards.
Convert between gallons and liters depending on which button is clicked. Your program must contain 2 functions, one that converts from gallons to liters and the other that converts from liters to gallons.
In an html form, collect a person's birthday and send it to a php program that will output the requested information. Use radio buttons to collect the month, a drop down menu (select) to collect the date, and a number type for the year (look it up). Make the number type for the year have a range of 1900 to 2016 with a default value of 1995. If the date is invalid, indicate it without outputting any requested information. For example, there is not a November 31st in any year. Not entering a month or day or year should also be considered invalid. There will be 5 checkboxes that the user can choose from to find out information about their birthday. Since these are checkboxes, the user can select any number of them. Each task below must have a corresponding function in the php program to return the result.
Season of the year (Winter, Spring, Summer, Fall). Look it up and be exact. Function parameters are month and day. Yes, I know it can't be exact without the year (for example, Winter started December 21 in 2014, December 22 in 2015, and will start December 21 in 2016). For simplicity, pick a usual start date and apply that for any year.
Zodiac sign (Capricorn, Aquarius, etc). Look it up and be exact. Function parameters are month and day.
Chinese animal sign (Monkey, Rooster, etc). While the Chinese New Year starts on different dates depending on the year, lets keep this simple and use only the year. Click HERE for a source of information. Function parameter is the year.
The person's age (as a whole number). Do not take code from the Internet, figure it out yourself and write the code yourself. Function parameters are month, day, and year.
The day of the week a person was born (Monday, Tuesday, etc). Function parameters are month, day, and year.
Click HERE for an example showing what should be included in the form and HERE for example output (note all 5 boxes were checked).
A good source of information for this program can be found by clicking HERE and in the class example date.php.
Some of you need to put in a better effort into making your webpages look nice. The class examples that I provide in class do NOT look nice, but that's not the purpose of my examples. I'm certainly willing to start handing out bonus points for outstanding effort and deducting points for lack of effort.
Upload a text file to the dropbox on D2L that indicates how long it took you to complete the assignment and what you learned. Also, indicate on your web page that you've completed the assignment (for example putting "done" or "completed" next to the assignment link) and how long it took you. Each php program should include buttons to navigate back to the input form, back to the assignment index, or back to your class interface page. I'll deducting points for lack of navigation buttons.
IMPORTANT: Since this is server side scripting, I won't be able to see that you used functions. Therefore, include the following 2 lines at the bottom of each your php programs
Here is the sample of the html:
here is sample of html and the out put from php
Explanation / Answer
Using formulas we can simply apply the conversions in the program
To find yards from meters
<?php
$yards = $meters * 1.0936133;
echo $yards." Yards";
?>
To find meters from yards
<?php
$meters = $yards / 1.0936133;
echo round($meters, 2)." Meters";
?>
To find the litres from Gallons
<?php
$litres = $gallon * 3.78541;
echo round($litres, 2)." litres";
?>
To find gallons from the litre
<?php
$gallon = $litres / 3.78541;
echo round($gallon, 2)." gallon";
?>
The validation in the PHP has Checkdate() function which validates the given date and returns back true or false for the given date.
<html>
<body>
<form action="validation.php" method="post">
month: <input type="number" name="month"><br>
date: <input type="number" name="date"><br>
Year <input type = "number" name = "year"> <br>
<input type="submit">
</form>
</body>
</html>
The validation.php has to include the following code
<html>
<body>
Welcome month<?php echo $_POST["month"]; ?><br>
year : <?php echo $_POST["year"]; ?>
date : <?php echo $_POST["date"]; ?>
</body>
</html>
<?php
var_dump(checkdate(month,date,year));
echo "<br>";
echo "<br>";
?>
It returns the answer bool(true) or bool (false) in the current page