![UML[ 03 ] Code with Abstract and Interface 1 UML[ 03 ] Code with Abstract and Interface 1](https://old.nurnobishanto.com/wp-content/uploads/2019/12/Q3.jpg)
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();
}
![UML[ 03 ] Code with Abstract and Interface 2 UML[ 03 ] Code with Abstract and Interface 2](https://old.nurnobishanto.com/wp-content/uploads/2019/12/Q3-output.jpg)
- UML[ 03 ] Code with Abstract and Interface
- UML[ 02 ] Code with Abstract and Interface
- UML[ 01 ] Code with Abstract and Interface
- UML Diagram to JAVA code [problem 5]
- UML Diagram to JAVA code [problem 4]
- UML Diagram to JAVA code [problem 3]
- UML Diagram to JAVA code [problem 2]
- UML Diagram to JAVA code [problem 1]
- Has relationship (Association) | Java UML to source code
- [ Is a ] Relationship (Inheritance) | Java UML source Code
- Story to UML to Java Source Code – 1