Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- spl_autoload_register(function($KelompokMakanan){
- include $KelompokMakanan.'.php';
- });
- class Manusia extends KelompokMakanan implements GayaHidup
- {
- private $jenis_kelamin;
- private $nama;
- private $tanggal_lahir;
- private $kebangsaan;
- private $nomor;
- function setJenis_kelamin($jenis_kelamin){
- $this->jenis_kelamin = $jenis_kelamin;
- }
- function setTanggalLahir($tanggal_lahir){
- $this->tanggal_lahir = $tanggal_lahir;
- }
- function setKebangsaan($kebangsaan){
- $this->kebangsaan = $kebangsaan;
- }
- function setNomor($nomor){
- $this->nomor = $nomor;
- }
- function getJenis_kelamin(){
- return $this->jenis_kelamin;
- }
- function getTanggalLahir(){
- return $this->tanggal_lahir;
- }
- function getKebangsaan(){
- return $this->kebangsaan;
- }
- function getNomor(){
- return $this->nomor;
- }
- public function bersuara()
- {
- echo $this->nama;
- }
- public function usia()
- {
- $date = date_create_from_format("d/m/Y", $this->tanggal_lahir);
- $tahunLahir = $date->format('Y');
- $tahunSekarang = date('Y');
- $usia = $tahunSekarang - $tahunLahir;
- return $usia;
- }
- function berbicara(){
- echo $this->kebangsaan;
- }
- function bernafas(){
- $nomor = $this->nomor;
- switch($nomor) {
- case '05': return 'Leader';
- case '06': return 'Humoris';
- case '07': return 'Support';
- case '13': return 'Co Leader';
- case '16': return 'Thinker';
- case '20': return 'Fak Boy';
- }
- }
- function makan(){
- $nomor = $this->nomor;
- switch($nomor) {
- case '05': return 'Ramen';
- case '06': return 'western';
- case '07': return 'Fried Rice';
- case '13': return 'Bread';
- case '16': return 'Kecap';
- case '20': return 'Chinese';
- }
- }
- function berjalan(){
- $nomor = $this->nomor;
- switch($nomor) {
- case '05': return 'Azka Show';
- case '06': return 'Bama Show';
- case '07': return 'Chandra Show';
- case '13': return 'Fajar Show';
- case '16': return 'Krisna Show';
- case '20': return 'Muhammad Show';
- }
- }
- function __construct($nama, $jenis_kelamin, $tanggal_lahir, $kebangsaan, $makanan, $nomor){
- $this->nama = $nama;
- $this->jenis_kelamin = $jenis_kelamin;
- $this->tanggal_lahir = $tanggal_lahir;
- $this->kebangsaan = $kebangsaan;
- $this->makanan = $makanan;
- $this->nomor = $nomor;
- }
- }
- ?>
Add Comment
Please, Sign In to add comment