Table of Contents


public abstract class Food {
	public String color;
	public Food(String color)
	{
		this.color=color;
		
	}
	public abstract void display();

}

public class Ingredients {

	private int noOfIngredients;
	public Ingredients(int noOfIngredients)
	{
		this.noOfIngredients=noOfIngredients;
	}
	public void display()
	{
		System.out.println("No OF Ingredients: "+noOfIngredients);
	}
}

public class Kacchi extends Food implements Price {
	Ingredients ing;
	public String typeOfKacchi,sizeOfPlate;
	
	

	
	public Kacchi(String color, Ingredients ing, String typeOfKacchi, String sizeOfPlate) {
		super(color);
		this.ing = ing;
		this.typeOfKacchi = typeOfKacchi;
		this.sizeOfPlate = sizeOfPlate;
	}
	public void display()
	{
		System.out.println("Color:"+color);
		ing.display();
		System.out.println("Type Of Kacchi:"+typeOfKacchi);
		System.out.println("Size Of Plate:"+sizeOfPlate);
	}


	public void highPrice() {
		System.out.println("High Price !");

	}

	
	public void lowPrice() {
		System.out.println("Low Price !");

	}
	public static void main(String[] args) {
		Ingredients i =new Ingredients(5);
		Kacchi k = new Kacchi("White",i,"Sindhi Biryani","Medium");
		k.display();
		k.highPrice();
		k.lowPrice();
		
	}

}

public interface Price {

	public void highPrice();
	public void lowPrice();
}
Output
Share on facebook
Facebook
Share on twitter
Twitter
Share on linkedin
LinkedIn
Share on pinterest
Pinterest
Share on whatsapp
WhatsApp
Share on email
Email
Md. Nurnobi Hosen
Md. Nurnobi Hosen

Student of Computer Science and Engineering at Daffodil International University,Main Campus ,Dhanmondi.
Web and App Developer also expart of wordpress customization

All Blog Posts »
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x