-
Notifications
You must be signed in to change notification settings - Fork 0
/
task2.txt
49 lines (37 loc) · 1.11 KB
/
task2.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
!DOCTYPE html>
<head>
<title>Assignment3</title>
</head>
<body>
<?php include 'menu.inc';
///////////////////////////////////////////////A////////////////////////////////////////////////////////////
class Square
{
private $name;
private $length;
function __construct($length){
$this->length =$length;
$this->name = "Square";
}
function getName(){
return $this->name;
}
function getLength(){
return $this->length;
}
function setLength($len){
$this->length=$len;
}
function getArea(){
return $this->length*$this->length;
}
function getPerimeter(){
return $this->length*4;
}
}
$shape = new Square(4);
echo "The name of the shape is: ".$shape->getName()."</br>";
echo "The length of one side of shape is: ".$shape->getLength()."</br>";
echo "The perimeter for the shape is: ".$shape->getPerimeter()."</br>";
echo "The Area for the shape is: ".$shape->getArea()."</br>";
?>