├── Constructor&Destructor ├── orang.php ├── orang1.php ├── orang2.php ├── orang3.php └── orang4.php ├── Ikantin ├── fungsi.php └── index.php ├── Inheritance ├── imherit2.php └── inherit1.php ├── Kalkulator ├── fungsi.php └── index.php ├── Polymorphism ├── abstract.php ├── clss-abstract.php ├── in&ab.php └── interface.php ├── README.md ├── Setter Getter └── setget.php ├── Visibility ├── Visibility.php └── fruit.php ├── konsep ├── bil.php ├── method-parameter.php └── method.php └── tugas kelompok ├── index.php └── percobaan.php /Constructor&Destructor/orang.php: -------------------------------------------------------------------------------- 1 | nama"; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /Constructor&Destructor/orang1.php: -------------------------------------------------------------------------------- 1 | nama="Rhoma Irama"; 5 | $dhika->UcapSalam(); 6 | echo "
"; 7 | $shelly=new Orang(); // instansiasi 8 | $shelly->nama="Iwan Fals"; 9 | $shelly->UcapSalam(); -------------------------------------------------------------------------------- /Constructor&Destructor/orang2.php: -------------------------------------------------------------------------------- 1 | nama=$nama; 6 | echo "Contructor: $this->nama dilahirkan
"; 7 | } 8 | function UcapSalam(){ 9 | echo "Hallo. Nama Saya adalah ".$this->nama."
"; 10 | } 11 | function __destruct(){ //pembuatan destructor 12 | echo "Destructor: $this->nama meninggal dunia
"; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Constructor&Destructor/orang3.php: -------------------------------------------------------------------------------- 1 | UcapSalam(); 5 | $orang2=new Orang("Orang 2"); 6 | $orang2->UcapSalam(); -------------------------------------------------------------------------------- /Constructor&Destructor/orang4.php: -------------------------------------------------------------------------------- 1 | name dan saya berasal dari $this->address"; 10 | } 11 | 12 | // destructor 13 | public function __destruct() 14 | { 15 | echo ' Ini dari destruktor.'; 16 | } 17 | 18 | // constructor 19 | public function __construct() 20 | { 21 | echo 'Ini dari konstruktor. '; 22 | } 23 | 24 | } 25 | 26 | // membuat object $eliff 27 | $eliff = new User(); 28 | 29 | // panggil method dari object $eliff 30 | echo $eliff->showBio(); 31 | ?> -------------------------------------------------------------------------------- /Ikantin/fungsi.php: -------------------------------------------------------------------------------- 1 | hargabakwan = 2000; 16 | $this->hargabakso = 10000; 17 | } 18 | } 19 | 20 | class Jumlah extends Produk { 21 | public function getJumlah($jmlbakwan, $jmlbakso){ 22 | $this->jmlbakwan = $jmlbakwan; 23 | $this->jmlbakso = $jmlbakso; 24 | } 25 | 26 | public function setHarga() { 27 | $this->totalhargabakwan = $this->hargabakwan * $this->jmlbakwan; 28 | $this->totalhargabakso = $this->hargabakso * $this->jmlbakso; 29 | $this->totalseluruh = $this->totalhargabakwan + $this->totalhargabakso; 30 | } 31 | 32 | public function cetakStruk(){ 33 | echo "******* Kantin Wikrama *******\n"; 34 | echo "
"; 35 | echo "Jumlah Bakwan: " . $this->jmlbakwan . "\n"; 36 | echo "
"; 37 | echo "Jumlah Bakso: " . $this->jmlbakso . "\n"; 38 | echo "
"; 39 | echo "Total Harga Bakwan: " . $this->totalhargabakwan . "\n"; 40 | echo "
"; 41 | echo "Total Harga Bakso: " . $this->totalhargabakso . "\n"; 42 | echo "
"; 43 | echo "Total Seluruh: " . $this->totalseluruh . "\n"; 44 | echo "
"; 45 | echo "*********************\n"; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Ikantin/index.php: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | ikantin Wikrama 16 | 17 | 18 | 19 | 20 | 21 | 43 |
44 |
45 |
46 |
47 |
48 |

Selamat datang di ikantin wikrama

49 |
50 |
51 |
52 |
53 |
54 |
55 |

Klik disini untuk pembelian

57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 | getJumlah(0, $jmlPc); 70 | } elseif ($jmlPc == null) { 71 | $jumlah->getJumlah($jmlbakso, 0); 72 | } else { 73 | $jumlah->getJumlah($jmlbakso, $jmlPc); 74 | } 75 | $jumlah->setHarga(); 76 | $jumlah->cetakStruk(); 77 | } 78 | ?> 79 |
80 |
81 |
82 |
83 |
84 |
85 |