Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

As part of the submission for this Lab, you will create your own Web page that u

ID: 3744706 • Letter: A

Question

As part of the submission for this Lab, you will create your own Web page that uses both HTML and PHP to create several different tables providing specific information. You will get a chance to use most of the concepts you studied so far in this course as you will apply both HTML and PHP code to this exercise. You may enhance your HTML display with CSS style sheets as desired but that is not required. Specifically, you will create a PHP Web application that provides 2 different tables. You will use your design skills to determine the size and organization of the resulting tables. The first table should include the results of using PHP to calculate several mathematical and trigonometric functions. Specifically, the following formulas should be implemented as functions in PHP: slope-intercept equation for a line: y = mx+b Slope intercept calculate y when x={2,5,8,10} for m=-2; b=0 Surface Area of Sphere: A = 4piR^2 Surface Area of Sphere A when R = {2,6,10, 100,1000}; Distance an object travels for given velocity and time : d = vt -- d when v={10m/s, 30m/s, 327m/s, 1200 m/s} for time from 0 to 10 in steps of 0.5 seconds.

Need to store data set in array and build the display output around HTML talbes that call those functions

Explanation / Answer

@@@Answer:

CODE:

1.)

function slopeeq($x)
{
// value of m is -2 and value of b is 0 and our equation is (mx + b)
  
$y = (-2*$x) + 0;
  
echo "Value of y is: " . $y;
  
}


// call the function and pass the value of x
slopeeq(2);

2.)

function areasphere($r)
{
// value of radius is passed by the user, area is calculated as per the formula (4*pi*r^2)
  
$area = 4*pi()*$r*$r ;
  
echo "Value of area is: " . $area;
  
}

// pass the value of radius as $r to the function
areasphere(2);

3.)

function distance($v)
{
// start the time with 0.5 seconds  
$t = 0.5;
  
  
// use a while loop to iterate
while($t <= 10)
{
echo "Distance travelled in $t seconds: " . $v*$t ;
echo "<br/> ";
  
$t = $t + 0.5;   
}   
}

// call the function and pass the value of velocity to the function
distance(10);

call the function and pass the argument/parameter to the function to generate the required value.