PHP Classes

File: Root66Implementation.php

Recommend this page to a friend!
  Classes of Lance Otis   Root66   Root66Implementation.php   Download  
File: Root66Implementation.php
Role: Example script
Content type: text/plain
Description: Demo implements the class
Class: Root66
Calculate the square, cube, and 5th roots
Author: By
Last change: added 5th root
Date: 1 year ago
Size: 1,776 bytes
 

Contents

Class file image Download
<?php

/**
 * @author Lance Otis
 * @copyright 2023
 * Verion 2 2/15/2023
 */

//Root Approximation
include ("classRoot66.php");

?>

<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
 
<style>
table, th, td {
  border: 1px solid black;
  padding: 8px;
}

</style>

</head>
<body>
<div style="background-color: beige; margin-left: 8px; width: 544px; height: 448px; border: 2px solid black; padding: 8px;" >
<form id="getInfo" method="post" target="_self">
Enter Number to get Root:
<input type="text" name="number" id="number"/> &nbsp;
<input type="submit" name="submit" value="Calc"/> &nbsp;
<input type="reset" name="reset" value="Reset"/> Ver:2.0<br/>
<div class="container">
<br />
<label class="radio-inline">
<input type="radio" id="Square" name="root" value="2" checked>Square Root &nbsp; &nbsp; &nbsp; &nbsp;
</lable>
<label class="radio-inline">
 <input type="radio" id="Cube" name = "root" value="3" >Cube Root &nbsp; &nbsp; &nbsp; &nbsp;
</lable>
<label class="radio-inline">
 <input type="radio" id="5th" name = "root" value="5" >5th Root
</lable>
</div>
<br />
Numbers < 999999999999
</form>
<br />

<?php

if (isset($_POST['submit'])) {

    echo
'<div style="background-color: beige; margin-left: 8px; margin-top: -20px; height: 120px; ">';
   
$number = ($_POST['number']);
   
$rootExponent = ($_POST['root']);
   
$root = new Root66($number, $rootExponent);
   
$root->getRoot();
    echo
"</div><pre>";
   
print_r($root->getRootArray());
    echo
"</pre>";

} else
    {echo
" Enter Number Above ";}

?>

</div>
</body>
</html>