Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional Microsoft SQL Server 2014 Administration

Authors: Adam Jorgensen, Bradley Ball

1st Edition

111885926X, 9781118859261

More Books

Students also viewed these Databases questions