0% found this document useful (0 votes)
7 views11 pages

Slip4A, slip5A,slip6A,slip7A Advance_PHP_Solution

The document contains multiple PHP scripts and HTML forms for various functionalities. It includes classes for managing employee data, calculating areas and volumes of geometric shapes, parsing URLs, and converting between kilograms and grams. Each section demonstrates object-oriented programming concepts and user interaction through web forms.

Uploaded by

sagarmeravi3616
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views11 pages

Slip4A, slip5A,slip6A,slip7A Advance_PHP_Solution

The document contains multiple PHP scripts and HTML forms for various functionalities. It includes classes for managing employee data, calculating areas and volumes of geometric shapes, parsing URLs, and converting between kilograms and grams. Each section demonstrates object-oriented programming concepts and user interaction through web forms.

Uploaded by

sagarmeravi3616
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 11

Slip4A.

php
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body style="background-color:orange;">
<?php
class Employee
{
private $eid,$ename,$edept,$salary;
function __construct($w,$x,$y,$z)
{
$this->eid=$w;
$this->ename=$x;
$this->edept=$y;
$this->salary=$z;
}
public function getdata()
{
return $this->salary;
}
public function display()
{
echo "<br>";
echo "<b>".$this->eid." ";
echo $this->ename." ";
echo $this->edept. "</b>";
}
}
class Manager extends Employee
{
private $bonus;
public static $total1=0;
function __construct($w,$x,$y,$z,$a)
{
parent::__construct($w,$x,$y,$z);
$this->bonus=$a;
}
public function max($ob)
{
$salary=$this->getdata();
$total=$salary+$this->bonus;
if($total>self::$total1)
{
self::$total1=$total;
return $this;
}
else
{
return $ob;
}
}
public function display()
{
parent::display();
echo"<b>".self::$total1."</b>";

}
$ob=new Manager(0,"ABC","",0,0);
$ob1=new Manager(1,"umesh","Finance",20000,2000);
$ob=$ob1->max($ob);
$ob->display();
$ob2=new Manager(2,"priyansh","Purchase",40000,2500);
$ob=$ob2->max($ob);
$ob->display();
?>
</table></body>
</html>
Slip5A.html
<html>
<body>
<form action="slip5A.php" method=get>
<center><h2>Enter values for Cone & Cylinder</h2>
<p>Enter Radius </td><td><input type="text" name="r"><br>
<p>Enter Height</td><td> <input type="text" name="h"><br>
<p><input type="submit" value="calculate">
</form>
</body>
</html>

Slip5A.php
<?php
define('pi',3.14);
abstract class shape
{
abstract function calc_area($r,$h);
abstract function calc_vol($r,$h);
}
class sphere extends shape
{
function calc_area($r,$h)
{
return 4*pi*$r*$r;
}

function calc_vol($r,$h)
{
return (4/3)*pi*$r*$r*$r;
}
}

class cylinder extends shape


{
function calc_area($r,$h)
{
return 2*pi*$r*($r+$h);
}

function calc_vol($r,$h)
{
return pi*$r*$r*$h;
}
}

class cone extends shape


{
function calc_area($r,$h)
{
return 0.5*$r*$r*$h;
}

function calc_vol($r,$h)
{
return $r*$r*$r*$h;
}
}
$r=$_GET['r'];
$h=$_GET['h'];
$ob=new cone();
echo "Area of cone ".$ob->calc_area($r,$h);
echo "</br>";
echo "Volume of cone ".$ob->calc_vol($r,$h);
echo "</br>";
$ob=new cylinder();
echo "Area of cylinder ".$ob->calc_area($r,$h);
echo "</br>";
echo "Volume of cylinder".$ob->calc_vol($r,$h);
echo "</br>";

$ob=new sphere();
echo "Area of sphere ".$ob->calc_area($r,$r);
echo "</br>";
echo "Volume of sphere ".$ob->calc_vol($r,$r);

?>

Slip6A.php
<?php
$url = 'http://www.college.com/Science/CS.php';
print_r(parse_url($url));
$scheme = parse_url($url,PHP_URL_SCHEME);
echo "<br><br>Scheme : $scheme";

$host = parse_url($url,PHP_URL_HOST);
echo "<br><br>Host : $host";
$path = parse_url($url,PHP_URL_PATH);
echo "<br><br>path : $path";
?>
Slip7A.html
<!DOCTYPE html>
<html>
<head>
<title>
</title>
</head>
<body style="background-color: pink;">
<form action="slip7A.php" method="post">
<table border="2">
<tr>
<th colspan="2">Convert Number Kg & Gm</th>
</tr>
<tr>
<td>Enter Number</td>
<td><input type="number" name="n">
</tr>

<tr>
<td>Select</td>
<td colspan="2"><input type="radio"name=op value=1>Convert Value Kg
to Gm<br>
<input type="radio" name=op value=2>Convert Value Gm to Kg<br>
</td>
</tr>
<tr>
<td colspan="2" class="button"><input type="submit"
value="Submit">
<input type="reset" name="reset" value="reset"></td>
</tr>
</table>
</form>

</body>
</html>
Slip7A.php
<?php
interface units
{
function convert($kg,$gm);

class kgtogm
{
function convert($kg)
{
//Convert Value Kg To Gm Formula grams=kilogram*1000;
return $kg*1000;
}

class gmtokg
{
function convert($gm)
{
//Convert Value Gm to Kg formula Kilograms=grams/1000;
return $gm/1000;
}

$op=$_POST['op'];

switch($op)
{

case 1 : $kg=$_POST['n'];//Base
$ob=new kgtogm();
$a=$ob->convert($kg);
echo "<h1>Convert Grams:".$a."gm</h1>";
break;

case 2 : $gm=$_POST['n'];//Side
$ob=new gmtokg();
$a=$ob->convert($gm);
echo "<h1>Convert kilograms:".$a."kg</h1>";
break;
}
?>
<style>
body
{
background-color: lightblue;
}
</style>

You might also like