1. Derive a class square from class Rectangle. Create one
more class circle. Create an interface with only one method called area ().
Implement this interface in all the classes. Include appropriate data members
and constructors in all classes. Write a program to accept details of a square,
circle and rectangle and display the area.
Html file :
<html>
<body>
<form
action="slip_3.php" method="get">
<h2> Square :
</h2>
Enter side for Square : <input
type="text" name=s>
<h2> Rectangle :
</h2>
Enter length
: <input type="text" name=l> <br>
Enter breath : <input
type="text" name=b>
<h2> Circle :
</h2>
Enter radius : <input
type="text" name=r> <br>
<input type="submit"
name=submit value=Submit>
<input type="reset"
name=reset value=reset>
</form>
</body>
</html>
Php file :
<?php
$s
= $_GET['s'];
$l
= $_GET['l'];
$b
= $_GET['b'];
$r
= $_GET['r'];
interface findarea
{
function area($l,$c);
}
class rectangle implements findarea
{
function area($l,$b)
{
$area =
$l*$b;
echo "Area
of Rectanle :".$area."<br>";
}
}
class square extends
rectangle
{
function area($s,$s)
{
$area =
$s*$s;
echo "Area
of Square :". $area."<br>";
}
}
class circle
{
function area($r)
{
$area =
0.5*$r*$r;
echo "Area
of Circle :". $area."<br>";
}
}
$fr
= new rectangle;
$fr->area($l,$b);
$fs
= new square;
$fs->area($s,$s);
$fc
= new circle();
$fc->area($r)
?>
ReplyDeleteThe info is good enough.I preview this type of good article only. Good job
DOT NET Training in Chennai
.Net course in chennai
Dot Net Training in OMR
Dot Net Training in Porur
Html5 Training in Chennai
QTP Training in Chennai
SAS Training in Chennai
DOT NET Training in Chennai
This post is so interactive and informative.keep update more information...
ReplyDeleteGerman Classes in Chennai
German Classes in Bangalore
German Classes in Coimbatore
German Classes in Madurai
German Language Course in Hyderabad
German Language Classes in Chennai
German language classes in bangalore
German Language Classes in Coimbatore
Ethical Hacking Course in Bangalore
IELTS Coaching in Bangalore
Pretty blog, i found some useful information from this blog, thanks for sharining the great information.
ReplyDeleteCyber Security Training Course in Chennai | Certification | Cyber Security Online Training Course | Ethical Hacking Training Course in Chennai | Certification | Ethical Hacking Online Training Course | CCNA Training Course in Chennai | Certification | CCNA Online Training Course | RPA Robotic Process Automation Training Course in Chennai | Certification | RPA Training Course Chennai | SEO Training in Chennai | Certification | SEO Online Training Course