using class in php
<?php
class sinhvien{
var $toan,$ly,$hoa;
function __construct($toan,$ly,$hoa)
{
$this->toan=$toan;
$this->ly=$ly;
$this->hoa=$hoa;
}
var $tb;
function tinhdiem(){
$toan=$this->toan;
$ly=$this->ly;
$hoa=$this->hoa;
$this->tb=($toan+$ly+$hoa)/3;
echo "sinh vien co tong diem".$this->tb;
}
function xeploai()
{
$xl=$this->tb;
if($xl<5){ echo " trung binh" ;}
else if ($xl>5 &&$xl<7 ){echo " trung binh kha ";}
else echo"gioi";
}
}
$a=new sinhvien(4,7,15);
$a->tinhdiem();
$a->xeploai();
?>
7/07/2009
Subscribe to:
Post Comments (Atom)
List
Profiles Information
About me : Nothing is 1 vài thứ - 1985
Places I've Lived : I ♥ Hà Nội
Home Page : http://www.shimivn.blogspot.com/
Think : 1:1000000000
Languages spoken : Vietnamese,English.
Mobile : sony C2305 ♥ ♥
dell : i3-Ram 3GB- HDD 250GB . ♥♥♥
Places I've Lived : I ♥ Hà Nội
Home Page : http://www.shimivn.blogspot.com/
Think : 1:1000000000
Languages spoken : Vietnamese,English.
Mobile : sony C2305 ♥ ♥
dell : i3-Ram 3GB- HDD 250GB . ♥♥♥
No comments: