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

1. Create a file named: DataTypes2.php in your text editor. 2. Set three integer

ID: 3550200 • Letter: 1

Question

1.    Create a file named: DataTypes2.php in your text editor.

2.    Set three integer variables to values of your choice

3.    Demonstrate with labels: 1) a math equation using integers and your variables); 2) using one of your variables, each of the assignment symbols (+=,-=,*=,/=); 3) incrementing & decrementing two different variables; 4) three of the six functions (i.e. absolute value, exponential, etc.) .

4.    Create a floating point variable of your choice using 4 significant digits (e.g., 1.1111).

5.    Demonstrate with labels: 1) your floating point number; 2) the three float rounding functions (for the first function, round to two digits)

6.    Put one of your variables and your floating point number through the integer, float, and numeric tests.

7.    Here is a sample of what your output should look like.

Basic Math: 7

+=: 5
-=: 3
*=: 21
/=: 7

Increment: 4
Decrement: 6

Exponential: 81
Square Root: 9
Random (min/max): 22

My Floating Point #: 7.437
Round: 7.44
Ceiling: 8
Floor: 7

Is 5 an integer? 1
Is 7.437 an integer?

Is 5 a float?
Is 7.437 a float? 1

Is 5 numeric? 1
Is 7.437 numeric? 1


Explanation / Answer

<?php


$Var1=12;

$Var2=13;

$Var3=20;


$sum=$var1+(Var2-5);

echo "Basic Math:". $sum . "<br>";

$Var2+=10;

$Var1-=2;

$Var3*=10;

$sum/=2;


echo " +=:" .$Var2 ."<br>";

echo " -=:".$Var1 ."<br>";

echo " *=: $Var3 <br>";

echo " /=: $sum <br>";



$var1--;

$var2++;


echo "Increment: $var1<br>";

echo "Decrement: $var1<br>";


echo "Absolute:";

abs(1.5);

echo "<br> Min:";

min(10,20,5,14);

echo "<br> Max:";

max(10,20,5,14);

echo"<br> square Root:";

sqrt(40);


$var4=10.6789;


echo "<br> my Floating Point Number is: $var4";

echo "<br> Round: ";

round($var4,2);

echo "<br> Ceiling:";

ceil($var4);

echo "<br> Floor: ";

floor($var4);


?>