Advertisement
rifat22

Soal No 6

Sep 24th, 2019
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.73 KB | None | 0 0
  1. <?php
  2. interface Ikontrol{
  3.     public function construct();
  4.     public function Berjalan();
  5.     public function Berhenti();
  6.  
  7. }
  8.  
  9. class Mobil implements Ikontrol {
  10.     public $perintah;
  11.     public function construct() {
  12.         echo $this->perintah = "Mobil Dapat";
  13.     }
  14.     public function Berjalan() {
  15.         echo $this->perintah = "berjalan dengan tuas gas";
  16.     }
  17.    
  18.     public function Berhenti() {
  19.         echo $this->perintah = "Berhenti dengan Tuas Rem";
  20.     }
  21.  
  22.     public function infoKontrol() {
  23.         echo $this->construct();
  24.         echo "</br>";
  25.         echo $this->Berjalan();
  26.         echo "</br>";
  27.         echo $this->Berhenti();
  28.  
  29.     }
  30.  
  31.  
  32. }
  33.  
  34. $mobil = new Mobil();
  35. $mobil->infoKontrol();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement