Example #1
0
 public MediumRare(double currentTemp, Steak steak)
 {
     this.currentTemp = currentTemp;
     this.steak       = steak;
     canEat           = true;
     Initialize();
 }
Example #2
0
        static void CommandPattern()
        {
            Waiter waiter = new Waiter();

            Pizza pizza1 = new Pizza(new string[1] { "cheese" });
            PizzaCommand pizzaCommand1 = new PizzaCommand(pizza1);
            waiter.AddOrder(pizzaCommand1);

            Steak steak = new Steak(Steak.SteakType.TBone, Steak.SteakPreperation.WellDone);
            SteakCommand steakCommand = new SteakCommand(steak);
            waiter.AddOrder(steakCommand);

            Wings wing1 = new Wings(Wings.WingFlavor.BBQ, 10);
            WingsCommand wingsCommand1 = new WingsCommand(wing1);
            waiter.AddOrder(wingsCommand1);

            Pizza pizza2 = new Pizza(new string[4] { "chicken", "bacon","ham","pepperoni" });
            PizzaCommand pizzaCommand2 = new PizzaCommand(pizza2);
            waiter.AddOrder(pizzaCommand2);

            Wings wing2 = new Wings(Wings.WingFlavor.HotGarlic,20);
            WingsCommand wingsCommand2 = new WingsCommand(wing2);
            waiter.AddOrder(wingsCommand2);

            Wings wing3 = new Wings(Wings.WingFlavor.SweetChili, 10);
            WingsCommand wingsCommand3 = new WingsCommand(wing3);
            waiter.AddOrder(wingsCommand3);

            waiter.ExecuteOrder();

            Console.WriteLine("**********************");
            Console.ReadLine();


        }
Example #3
0
 public Medium(double currentTemp, Steak steak)
 {
     _currentTemp = currentTemp;
     _steak       = steak;
     _canEat      = true;
     Initialize();
 }
Example #4
0
        // Help the user find a steak. Return its id.

        // 1. Ask the user for the name of the steak they want to find.
        // 2. Search SteakRepository.steakList for a steak with that name.
        // 3. If no steak was found for that name, ask for a new name.
        // 4. If steak was found, return the Id of that steak.
        public static int SearchSteak()
        {
            Steak foundSteak = null;

            do
            {
                Console.WriteLine("Enter the Name of the Steak");
                string inputSearchName = Console.ReadLine();

                foreach (Steak steak in SteakRepository.steakList)
                {
                    if (inputSearchName == steak.Name)
                    {
                        foundSteak = steak;
                    }
                }

                if (foundSteak == null)
                {
                    Console.WriteLine("That Steak Name is not in the List.");
                }
            } while (foundSteak == null);

            return(foundSteak.Id);
        }
Example #5
0
        private static void CreateSteak()
        {
            Steak mySteak = SteakView.GetNewSteakData();

            SteakRepository.Create(mySteak);
            SteakView.DisplaySteak(mySteak);
        }
Example #6
0
 public WellDone(double currentTemp, Steak steak)
 {
     _currentTemp = currentTemp;
     _steak       = steak;
     _canEat      = true;
     Initialize();
 }
 public NotCooked(Steak state)
 {
     this.currentTemp = 0;
     this.streak      = state;
     Initialize();
     CheckState();
 }
Example #8
0
        private static void SearchSteaks()
        {
            int   steakId = SteakView.SearchSteak();
            Steak mySteak = SteakRepository.ListById(steakId);

            SteakView.DisplaySteak(mySteak);
        }
Example #9
0
 public Ruined(double currentTemp, Steak steak)
 {
     this.currentTemp = currentTemp;
     this.steak       = steak;
     canEat           = true;
     Initialize();
 }
Example #10
0
 public Rare(double currentTemp, Steak steak)
 {
     this.currentTemp = currentTemp;
     this.steak       = steak;
     canEat           = true; //We can now eat the steak
     Initialize();
 }
Example #11
0
 public Rare(double currentTemp, Steak state)
 {
     this.currentTemp = currentTemp;
     this.streak      = state;
     Initialize();
     CheckState();
 }
 public Welldone(double currentTemp, Steak steak)
 {
     this.currentTemp = currentTemp;
     this.streak      = steak;
     Initialize();
     CheckState();
 }
Example #13
0
        public burnt(double currentTemp, Steak steak)
        {
            Console.WriteLine("you have burnt the steak. make a new one");
            int useless = Console.Read();

            System.Environment.Exit(1);
        }
        void Start()
        {
            Person person = new Person();

            person.Name = "Bob";

            var apple = new Apple();

            person.Eat(apple);

            var cookie = new Cookie();

            person.Eat(cookie);

            var donut = new Donut();

            person.Eat(donut);

            var pancake = new Pancake();

            person.Eat(pancake);

            var sandwich = new Sandwich();

            person.Eat(sandwich);

            var steak = new Steak();

            person.Eat(steak);
        }
Example #15
0
 public WellDone(double currentTemp, Steak steak)
 {
     this.currentTemp = currentTemp;
     this.steak       = steak;
     this.canEat      = true;
     Initialize();
 }
Example #16
0
 public MediumRare(double currentTemp, Steak steak)
 {
     this.currentTemp = currentTemp;
     this.streak      = steak;
     Initialize();
     CheckState();
 }
Example #17
0
        static void Main(string[] args)
        {
            bool  stop    = true;
            Steak account = new Steak("me");

            while (stop)
            {
                //get an input
                var input = Console.ReadLine();
                if (input == "")
                {
                    stop = !stop;
                    break;
                }
                //make sure we have a number
                foreach (char c in input)
                {
                    //if not a number
                    if (Char.IsLetter(c))
                    {
                        //kill the loop and then the loop
                        stop = false;
                        break;
                    }
                }
                //do stuff
                if (stop)
                {
                    double inputNum = double.Parse(input);
                    account.AddTemp(inputNum);
                }
            }
        }
Example #18
0
        // Replace the steak with Id, with the new steak
        public static void Edit(int Id, Steak newSteak)
        {
            // 1. Search steakList for a steak with an id equal to Id - in the repository or in View? I thought to dao a Contains() in View but save to repo?
            // I think the idea is that this steak parameter has already been edited, and now we just want to save it to the list.
            // The steak that's getting passed in IS the edited steak.

            // 2. Replace that steak with this newSteak.
        }
Example #19
0
 public Uncooked(Steak meat)
 {
     steak       = meat;
     currentTemp = 0;
     lowerTemp   = 0;
     upperTemp   = 130;
     CanEat      = false;
 }
Example #20
0
        public Rare(double currentTemp, Steak steak)
        {
            _currentTemp = currentTemp;
            _steak       = steak;
            //We can now eat the steak
            _canEat = true;

            Initialize();
        }
Example #21
0
        public Uncooked(Steak steak, double currentTemperature)
        {
            _steak = steak;
            _currentTemperature = currentTemperature;

            _lowerTemperature = 0;
            _upperTemperature = 49;
            _isSafeToEat      = false;
        }
Example #22
0
        public static Steak GetNewSteakData()
        {
            bool   validWeight = false;
            double readWeight;
            bool   boneAnswered = false;
            bool   HasBone;

            Console.WriteLine("Enter the Name of the Steak");
            string inputName = Console.ReadLine();

            Console.WriteLine("What part of the cow is this Steak Cut from?");
            string inputCut = Console.ReadLine();


            Console.WriteLine("What is the Weight, in ounces, of the Steak? (please input a double)");
            string inputWeight = Console.ReadLine();

            do
            {
                if (!double.TryParse(inputWeight, out readWeight))
                {
                    Console.WriteLine("Invalid Input");
                }
                else if (double.TryParse(inputWeight, out readWeight))
                {
                    validWeight = true;
                }
            } while (!validWeight);


            Console.WriteLine("Is there a Bone in this Steak? Type Y for Yes or N for No.");
            string inputIsBoneIn = Console.ReadLine();

            do
            {
                if (inputIsBoneIn == "Y" || inputIsBoneIn == "y")
                {
                    HasBone      = true;
                    boneAnswered = true;
                }
                else if (inputIsBoneIn == "N" || inputIsBoneIn == "n")
                {
                    HasBone      = false;
                    boneAnswered = true;
                }
                else
                {
                    Console.WriteLine("Invalid Input");
                    HasBone = false;
                }
            } while (!boneAnswered);

            Steak mySteak = new Steak(inputName, inputCut, readWeight, HasBone);

            Console.WriteLine("Steak Created!");
            return(mySteak);
        }
Example #23
0
        private static void EditSteak()
        {
            int   Id      = SteakView.SearchSteak();
            Steak mySteak = SteakRepository.ListById(Id);

            mySteak = SteakView.EditSteakInfo(mySteak);
            SteakRepository.Edit(mySteak.Id, mySteak);
            SteakView.DisplaySteak(mySteak);
        }
Example #24
0
        public void AnimalSerializeTest()
        {
            var pet   = AnimalFactory.CreateAnimal("Cat", Gender.Male, "Wiskers");
            var pizza = new Pizza();
            var steak = new Steak();

            pet.FoodsInfinite = new List <Food> {
                pizza, steak
            };
            pet.Serialize();
        }
Example #25
0
        static void Main(string[] args)
        {
            ICookingStrategy cookingStrategy = new WellDoneStrategy();
            IMeat            steak           = new Steak(cookingStrategy);

            Console.WriteLine($"Currently the steak is {steak.State()}");
            Console.WriteLine("Cooking...");
            steak.Cook();
            Console.WriteLine($"The steak is now cooked and it is {steak.State()}");
            Console.WriteLine();
        }
Example #26
0
            static void StateCalling()
            {
                Steak steak = new Steak("T-Bone");

                steak.AddTemp(120);
                steak.AddTemp(15);
                steak.AddTemp(15);
                steak.RemoveTemp(10);
                steak.RemoveTemp(15);
                steak.AddTemp(20);
                steak.AddTemp(20);
                steak.AddTemp(20);
            }
Example #27
0
        static void Main(string[] args)
        {
            Steak account = new Steak("T-Bone");

            account.AddTemp(120);
            account.AddTemp(15);
            account.AddTemp(15);
            account.RemoveTemp(10);
            account.RemoveTemp(15);
            account.AddTemp(20);
            account.AddTemp(20);
            account.AddTemp(20);
        }
Example #28
0
        private static void Main()
        {
            Steak account = new Steak("T-Bone");

            // Apply temperature changes.
            account.AddTemp(120);
            account.AddTemp(15);
            account.AddTemp(15);
            account.RemoveTemp(10);
            account.RemoveTemp(15);
            account.AddTemp(20);
            account.AddTemp(20);
            account.AddTemp(20);
        }
Example #29
0
        // Add the steak to the steakList
        public static Steak Create(Steak steak)
        {
            if (steakList.Contains(steak))
            {
                return(null);
            }
            else
            {
                steakList.Add(steak);
            }
            return(steak);

            //steakList.FirstOrDefault(d => d.Id == steak.Id);construtor should do this in Models
        }
Example #30
0
        public static void State()
        {
            //Let's cook a steak!
            Steak account = new Steak("T-Bone");

            // Apply temperature changes
            account.AddTemp(120);
            account.AddTemp(15);
            account.AddTemp(15);
            account.RemoveTemp(10); //Yes I know cooking doesn't work this way, bear with me.
            account.RemoveTemp(15);
            account.AddTemp(20);
            account.AddTemp(20);
            account.AddTemp(20);
        }