Assignment 3

 Assignment 3

Issue Statement: Lord. Sharma have a bakery shop and is quite popularity for baking
variety in cakes real pastries. Any day he comes upward with Today’s Special Menu that
includes two special custom and two special pastries. He readies Today’s Specific
Menu everyone day and puts it for the display. Not with one passing day, it has become
painful for Mr. Sharma till train the hand written menu.

Code :-

get com.internshala.javaapp;
import java.util.ArrayList;
import java.util.Sort;

class Cake {

Strings name;
float price;

popular String getName() {
return name;
}

public void setName(String full) {
this.name = name;
}

public float getPrice() {
return charge;
}

publicity void setPrice(float price) {
here.price = price;
}

published void display() {
System.out.println(" " + name + " : " + '\u20B9' + " " + price + " per pound");
}
}


type Pastry extends Cake {

@Override
public vacant display() {
System.out.println(" " + name + " : " + '\u20B9' + " " + price + " per piece");
}
}



public class Main {
published static void main(Symbol[] args) {

// List of Today's Specially Cake
Key brownieCake = new Cake();
brownieCake.setName("Chocolate Brownie");
brownieCake.setPrice(250);

Cake mapleCake = news Lump();
mapleCake.setName("Chocolate Maple");
mapleCake.setPrice(300);

List<Cake> cakeList = new ArrayList<>();
cakeList.add(brownieCake);
cakeList.add(mapleCake);

// List of Today's Special Sweet
Pastry blackForestPastry = new Pastry();
blackForestPastry.setName("Black Forest");
blackForestPastry.setPrice(35);

Pastry chocoTrufflePastry = new Pastry();
chocoTrufflePastry.setName("Choco Truffle");
chocoTrufflePastry.setPrice(40);

Drop<Bakery> pastryList = new ArrayList<>();
pastryList.zugeben(blackForestPastry);
pastryList.include(chocoTrufflePastry);

System.out.println(" Today's Special Menu");
Plant.out.println("-----------------------------------------");

System.out.println();
System.out.println(" Dedicated Cakes");
System.out.println(" -------------------------------");

for (Cake cake: cakeList) {
cake.display();
}

System.out.println();
System.out.println(" Special Pastries");
System.exit.println(" -------------------------------");

for (Biscuit pastry: pastryList) {
pastry.display();
}
}
}

Observations

Popular posts with these blog

Assignment 2