Question
DRIVER public class GroceryStoreDriver { public void runStore() { GroceryStore groceryStore = new GroceryStore(); Cereal breakfast1 = groceryStore.orderCereal(frosted flakes); System.out.println( ----------------------------------- ); Cereal breakfast2 =
DRIVER
public class GroceryStoreDriver {
public void runStore() { GroceryStore groceryStore = new GroceryStore(); Cereal breakfast1 = groceryStore.orderCereal("frosted flakes"); System.out.println(" ----------------------------------- "); Cereal breakfast2 = groceryStore.orderCereal("fruit loops"); System.out.println(" ----------------------------------- "); Cereal breakfast3 = groceryStore.orderCereal("lucky charms"); } public static void main(String[] args) { GroceryStoreDriver gsDriver = new GroceryStoreDriver(); gsDriver.runStore(); } }
Cereal is abstract
OUTPUT
Preparing the Frosted Flakes - Gather the grain - Shape into flakes - Sprinkle with frosting Drawing fun pictures of Frosted Flakes on the box Pouring the Frosted Flakes into the box Putting price tag of $2.99 on the Frosted Flakes box
-----------------------------------
Preparing the Fruit Loops - Gather the grain - Shape into circles - Randomly color circles - Let circles dry Drawing fun pictures of Fruit Loops on the box Pouring the Fruit Loops into the box Putting price tag of $1.89 on the Fruit Loops box
-----------------------------------
Preparing the Lucky Charms - Gather the grain - Shape into circles - Create marshmallow shapes - Mix circles and marshmallows Drawing fun pictures of Lucky Charms on the box Pouring the Lucky Charms into the box Putting price tag of $1.55 on the Lucky Charms box
Cereal Grocery Store # name: String #price: Double + orderCereal(String type): Cereal - createCereal(String type): Cereal + prepare(): void + boxCerealo: void + priceCereal(): void Frosted Flakes LuckyCharms FruitLoops + Frosted Flakes + prepare(): void + LuckyCharms + prepare(): void + FruitLoops + prepare(): void Cereal Grocery Store # name: String #price: Double + orderCereal(String type): Cereal - createCereal(String type): Cereal + prepare(): void + boxCerealo: void + priceCereal(): void Frosted Flakes LuckyCharms FruitLoops + Frosted Flakes + prepare(): void + LuckyCharms + prepare(): void + FruitLoops + prepare(): void
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started