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:
Implement the pizza application and run it on your .NET
Implement the same application by using an interface.
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
Step: 1
Get Instant Access to Expert-Tailored 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