Question: Pizza.cs file using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace PizzaApplication { public enum PizzaType {ChicagoStyle, Greek, Veggie, Cheese } public class
Pizza.cs file using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks; namespace PizzaApplication {
public enum PizzaType {ChicagoStyle, Greek, Veggie, Cheese }
public class Pizza {
public void Prepare(PizzaType tp) {
switch (tp) {
case PizzaType.ChicagoStyle:
PrepareIngredientsForChicagoStylePizza();
break;
case PizzaType.Greek:
PrepareIngredientsForGreekPizza();
break;
case PizzaType.Veggie:
PrepareIngredientsForVeggiePizza();
break;
case PizzaType.Cheese:
PrepareIngredientsForGreekPizza();
break;
default:
PrepareIngredientsForUnknownPizza();
break; } } public void PrepareIngredientsForChicagoStylePizza() { Console.WriteLine("Preparing ingredients for the Chicago-style pizza"); }
public void PrepareIngredientsForGreekPizza() { Console.WriteLine("Preparing ingredients for the Greek pizza"); } public void PrepareIngredientsForVeggiePizza() { Console.WriteLine("Preparing ingredients for the veggie pizza"); } public void PrepareIngredientsForCheesePizza() { Console.WriteLine("Preparing ingredients for the cheese pizza"); } public void PrepareIngredientsForUnknownPizza() { Console.WriteLine("Preparing ingredients for this pizza is unknown"); } } } Program.cs using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks; namespace PizzaApplication {
class Program {
static void Main(string[] args) {
Pizza p = new Pizza();
p.Prepare(PizzaType.Veggie);
p.Prepare(PizzaType.Cheese);
p.Prepare(PizzaType.ChicagoStyle); Console.ReadLine(); }
}
} For the C# application above, apply the tasks below: a. Implement the pizza application and run it on your .NET
b. Implement the same application by using an interface.
c. What is the difference between the first and second applications? Explain your opinion briefly.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
