Esempio n. 1
0
        static void Main(string[] args)
        {
            var pizzaRucola = new PizzaBuilder(PizzaBase.Tomato)
                              .AddMozzarella()
                              .AddHam()
                              .AddRocketSalad()
                              .Create();

            var pizzaChips = new PizzaBuilder(PizzaBase.White)
                             .AddMozzarella()
                             .AddChips()
                             .Create();

            var pizzaHawaii = new PizzaBuilder(PizzaBase.Tomato)
                              .AddMozzarella()
                              .AddHam()
                              .AddAnanas()
                              .Create();

            Console.Read();
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            string _crust   = "";
            string _size    = "";
            string _cheese  = "";
            string _topping = "";
            string _sauce   = "";
            string payment  = "";
            long   _cardNumber;
            bool   _isCash;

            Console.WriteLine("Welcome to Oriented Pizzas!\n");

            Pizza fakePizza = new PizzaBuilder().build();

            Console.WriteLine("Size\t" + "Price\t");
            Console.WriteLine("-------------");
            fakePizza.createOptions();
            foreach (string p in fakePizza.Options)
            {
                Console.WriteLine(p);
            }

            Console.WriteLine("\nWhat size pizza would you like? Enter the size.");
            _size = Console.ReadLine();
            Console.Clear();


            foreach (string crust in Enum.GetNames(typeof(Crust)))
            {
                Console.WriteLine("{0}\t{1:D}\t", crust,
                                  ((((float)((int)(Enum.Parse(typeof(Crust), crust))))) / 100).ToString("0.00"));
            }

            Console.WriteLine("\nWhat stlye crust would you like? Enter crust name.");
            _crust = Console.ReadLine();
            Console.Clear();

            foreach (string sauce in Enum.GetNames(typeof(Sauce)))
            {
                Console.WriteLine("{0}\t  {1:D}\t", sauce,
                                  ((((float)((int)(Enum.Parse(typeof(Sauce), sauce))))) / 100).ToString("0.00"));
            }

            Console.WriteLine("\nWhat kind of sauce would you like? Enter sauce name.");
            _sauce = Console.ReadLine();
            Console.Clear();

            foreach (string cheese in Enum.GetNames(typeof(Cheese)))
            {
                Console.WriteLine("{0}\t{1:D}\t", cheese,
                                  ((((float)((int)(Enum.Parse(typeof(Cheese), cheese))))) / 100).ToString("0.00"));
            }

            Console.WriteLine("\nWhat cheese would you like? Enter cheese name.");
            _cheese = Console.ReadLine();
            Console.Clear();

            foreach (string topping in Enum.GetNames(typeof(Topping)))
            {
                Console.WriteLine("{0}\t{1:D}\t", topping,
                                  ((((float)((int)(Enum.Parse(typeof(Topping), topping))))) / 100).ToString("0.00"));
            }

            Console.WriteLine("\nWhat topping would you like? Enter topping name.");
            _topping = Console.ReadLine();
            Console.Clear();

            Pizza pizza = new PizzaBuilder().withCrust(_crust).withTopping(_topping)
                          .withSize(_size).withCheese(_cheese).withSauce(_sauce).build();

            float price = pizza.getTotalPrice();

            Console.WriteLine("You're pizza is " + price.ToString("0.00") + " are you paying with cash or card? Enter cash or card.");
            payment = Console.ReadLine();
            Console.Clear();


            if (payment == "card")
            {
                _isCash = false;
                Console.WriteLine("What is your card number?");
                _cardNumber = long.Parse(Console.ReadLine());
                Console.Clear();
            }
            else
            {
                _isCash     = true;
                _cardNumber = 0;
            }

            Console.WriteLine("What is the name for the order? Enter it below.");
            string _name = Console.ReadLine();

            Console.Clear();

            Console.WriteLine("Where would your pizza delivered? Enter an adress.");
            string _address = Console.ReadLine();

            Console.Clear();

            Console.WriteLine("Thanks for choosing Oriented Pizza " + _name + ", your order has been submitted.");
            Console.ReadLine();
            Console.Clear();

            customer newCust = new customer(_name, _address, _cardNumber, _isCash);
        }
Esempio n. 3
0
 public PizzaShop(PizzaBuilder pizzaBuilder)
 {
     this.pizzaBuilder = pizzaBuilder;
 }
Esempio n. 4
0
 public PizzaShop(PizzaBuilder pizzaBuilder)
 {
     this.pizzaBuilder = pizzaBuilder;
 }