Package com.person

Source Code of com.person.Cooker

package com.person;

import com.Menu;
//import com.Animal.duck;  // ini case sensitive yak, nama folder, dan class-nya
import com.MenuType;
import com.animal.Duck; //nama folder selalu huruf kecil, nama class selalu huruf pertama kapital
import com.animal.PAnimal;

public class Cooker {
    public void cook(Duck duck) {
        Menu menu1 = new Menu(1, "bebek", MenuType.FRIED); // pake enum sebagai parameter
        Menu menu2 = new Menu(2, "bebek", MenuType.ROASTED);
        Menu menu3 = new Menu(3, "bebek biasa"); // ini mirip yg kmrn

        menu1.process(duck);
        menu2.process(duck);
        menu3.process(duck);
    }

    /* contoh method dengan argument parameter polymorphism */
    public void wash(PAnimal animal) {
        System.out.println("washing animal weight "+ animal.getWeight() + " kilograms");
    }
}
TOP

Related Classes of com.person.Cooker

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.