0% found this document useful (0 votes)
5 views4 pages

Tugas

Uploaded by

antoniusata380
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)
5 views4 pages

Tugas

Uploaded by

antoniusata380
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/ 4

Class Balok{

Private $panjang;

Private $lebar;

Private $tinggi;

Public function __construct($panjang, $lebar, $tinggi)

$this->panjang = $panjang;

$this->lebar = $lebar;

$this->tinggi = $tinggi;

Public function getPanjang()

Return $this->panjang;

Public function setPanjang($panjang)

$this->panjang = $panjang;

Public function getLebar()

Return $this->lebar;

Public function setLebar($lebar)

{
$this->lebar = $lebar;

Public function getTinggi()

Return $this->tinggi;

Public function setTinggi($tinggi)

$this->tinggi = $tinggi;

Public function luasPermukaan()

Return 2 * (($this->panjang * $this->lebar) + ($this->panjang *


$this->tinggi) + ($this->lebar * $this->tinggi));

Public function volume()

Return $this->panjang * $this->lebar * $this->tinggi;

Public function __destruct()

Var_dump(“Program Selesai”);

}
$balok1 = new Balok(10, 5, 20);

// Testing

$balok1->setPanjang(15);

Var_dump($balok1->luasPermukaan());

Var_dump($balok1->volume());

You might also like