/// <summary> /// Basic Pizza choice has no pizza with default pizza /// constructor. /// </summary> public Pizza() { toppings = new List <Toppings>(); pizzaSize = PizzaSize.twelveInch; crust = Crust.thin; //defaultToppings(); }
public override string ToString() { string output = ""; if (!(Crust is null)) { output += "Crust: " + Crust.ToString() + "\n"; } if (!(Size is null)) { output += "Size: " + Size.ToString() + "\n"; } if (!(Cheese is null)) { output += "Cheese: " + Cheese.ToString() + "\n"; } output += "Toppings: \n"; foreach (var t in _toppings) { output = output + t.ToString() + "\n"; } output += "Cost: $" + GetCost(); return(output); }
public Pizza() { pizTopList.Add("peperoni"); pizTopList.Add("bacon"); cost = 1.00m; toppingsMax = 2; crust = new Crust(); size = new Size(); cost = cost + crust.returnCrustCost() + size.returnSizeCost(); menu(); System.Console.WriteLine("\n\n"); System.Console.WriteLine("Your " + size.returnSize() + " " + crust.returnCrust() + " Pizzawith "); foreach (string s in pizTopList) { System.Console.Write(s + ", "); } System.Console.Write(" will be totaled at " + cost); }
public Pizza(Crust crust, Size size, Topping[] toppings) { Crust = crust; Size = size; Toppings.AddRange(toppings); }
/// <summary> /// returns total price of pizza ordered. /// </summary> /// <returns></returns> public double getPriceOfPizza() { double ToppingsPrice = 0.0; double CrustMultiplier; double pizzaSizeCost = 0.0; // Chosen Size PizzaSize size = pizzaSize; switch (size) { case PizzaSize.twelveInch: pizzaSizeCost = 5.0; break; case PizzaSize.fifteenInch: pizzaSizeCost = 8.0; break; case PizzaSize.twentyInch: pizzaSizeCost = 11.0; break; default: Console.WriteLine("no pizza size chosen."); Thread.Sleep(3000); break; } // Chosen crust Crust crust = this.crust; switch (crust) { case Crust.cheesefilled: CrustMultiplier = 1.5; break; case Crust.deepdish: CrustMultiplier = 1.3; break; case Crust.thin: CrustMultiplier = 1.1; break; default: Console.WriteLine("No crust was chosen."); CrustMultiplier = 1.0; Thread.Sleep(3000); break; } // Chosen Toppings if (toppings.Contains(Toppings.cheese)) { ToppingsPrice += 1.50; } if (toppings.Contains(Toppings.sauce)) { ToppingsPrice += 1.25; } if (toppings.Contains(Toppings.pepperoni)) { ToppingsPrice += 1.60; } if (toppings.Contains(Toppings.sausage)) { ToppingsPrice += 1.70; } if (toppings.Contains(Toppings.pineapple)) { ToppingsPrice += 1.75; } // return total cost of pizza return(pizzaSizeCost * CrustMultiplier + ToppingsPrice); }
/// <summary> /// Customer chooses their crust /// </summary> /// <param name="c"></param> public void chooseCrust(Crust c) { crust = c; }