tugas 5 : Polimerfisme (Faimawat / 2012420154)

tugas 5 : Polimerfisme (Faimawat / 2012420154)

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package polimerfisme;

/**
 *
 * @author User
 */
public class perabot {

    /**
     * @param args the command line arguments
     */
    public String merk;
    public String fungsi;
    public String tempat;
   
    public void rumah (String merk){
        System.out.println("Merk Perabotannya : " + getMerk());
    }
    public void home (String fungsi, String tempat){
        System.out.println("Perabot ini berfungsi untuk : " + getFungsi());
        System.out.println("Di tempatkan : " + getTempat());
    }

    /**
     * @return the merk
     */
    public String getMerk() {
        return merk;
    }

    /**
     * @param merk the merk to set
     */
    public void setMerk(String merk) {
        this.merk = merk;
    }

    /**
     * @return the fungsi
     */
    public String getFungsi() {
        return fungsi;
    }

    /**
     * @param fungsi the fungsi to set
     */
    public void setFungsi(String fungsi) {
        this.fungsi = fungsi;
    }

    /**
     * @return the tempat
     */
    public String getTempat() {
        return tempat;
    }

    /**
     * @param tempat the tempat to set
     */
    public void setTempat(String tempat) {
        this.tempat = tempat;
    }
    }

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package polimerfisme;

/**
 *
 * @author User
 */
public class perabotkompor {
    public void panas(){
        System.out.println("Ini menghasilkan energi panas");
    }
    public static void main(String[] args) {
        perabot z = new perabot();
        z.setMerk("Rinai");
        z.rumah(z.getMerk());
        z.setFungsi("Memasak");
        z.setTempat("Di Dapur");
        z.home(z.getFungsi(), z.getTempat());
        perabotkompor v = new perabotkompor();
        v.panas();
    }
}

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package polimerfisme;

/**
 *
 * @author User
 */
public class perabotkulkas {
    public void dingin(){
        System.out.println("Kulkas itu dingin");   
    }
    public static void main(String[] args) {
        perabot x = new perabot();
        x.setMerk("Panasonic");
        x.rumah(x.getMerk());
        x.setFungsi("Penyimpanan Makanan");
        x.setTempat("Di dapur");
        x.home(x.getFungsi(), x.getTempat());
        perabotkulkas y = new perabotkulkas();
        y.dingin();
    }
    }
   
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package polimerfisme;

/**
 *
 * @author User
 */
public class perabottv {
    public void panas(){
        System.out.println("Bisa menghasilkan energi panas bila terlalu lama di nyalakan");
    }
    public void info(){
        System.out.println("Kita juga bisa mendapatkan informasi");
    }
    public static void main(String[] args) {
        perabot a = new perabot();
        a.setMerk("Samsung");
        a.rumah(a.getMerk());
        a.setFungsi("Mendapatkan informasi dan hiburan");
        a.setTempat("Di ruang keluarga");
        a.home(a.getFungsi(), a.getTempat());
        perabottv b = new perabottv();
        b.panas();
        b.info();
    }
}



share this article to: Facebook Twitter Google+ Linkedin Technorati Digg
Posted by arek informatika, Published at 00.19 and have 0 komentar

Tidak ada komentar:

Posting Komentar