コード例 #1
0
 public MediumRare(double currentTemp, Steak steak)
 {
     this.currentTemp = currentTemp;
     this.steak       = steak;
     canEat           = true;
     Initialize();
 }
コード例 #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();


        }
コード例 #3
0
ファイル: Medium.cs プロジェクト: A9dr8weed/State
 public Medium(double currentTemp, Steak steak)
 {
     _currentTemp = currentTemp;
     _steak       = steak;
     _canEat      = true;
     Initialize();
 }
コード例 #4
0
ファイル: SteakView.cs プロジェクト: vkwithluv/ReposSG
        // 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);
        }
コード例 #5
0
ファイル: SteakController.cs プロジェクト: vkwithluv/ReposSG
        private static void CreateSteak()
        {
            Steak mySteak = SteakView.GetNewSteakData();

            SteakRepository.Create(mySteak);
            SteakView.DisplaySteak(mySteak);
        }
コード例 #6
0
ファイル: WellDone.cs プロジェクト: A9dr8weed/State
 public WellDone(double currentTemp, Steak steak)
 {
     _currentTemp = currentTemp;
     _steak       = steak;
     _canEat      = true;
     Initialize();
 }
コード例 #7
0
 public NotCooked(Steak state)
 {
     this.currentTemp = 0;
     this.streak      = state;
     Initialize();
     CheckState();
 }
コード例 #8
0
ファイル: SteakController.cs プロジェクト: vkwithluv/ReposSG
        private static void SearchSteaks()
        {
            int   steakId = SteakView.SearchSteak();
            Steak mySteak = SteakRepository.ListById(steakId);

            SteakView.DisplaySteak(mySteak);
        }
コード例 #9
0
 public Ruined(double currentTemp, Steak steak)
 {
     this.currentTemp = currentTemp;
     this.steak       = steak;
     canEat           = true;
     Initialize();
 }
コード例 #10
0
 public Rare(double currentTemp, Steak steak)
 {
     this.currentTemp = currentTemp;
     this.steak       = steak;
     canEat           = true; //We can now eat the steak
     Initialize();
 }
コード例 #11
0
 public Rare(double currentTemp, Steak state)
 {
     this.currentTemp = currentTemp;
     this.streak      = state;
     Initialize();
     CheckState();
 }
コード例 #12
0
 public Welldone(double currentTemp, Steak steak)
 {
     this.currentTemp = currentTemp;
     this.streak      = steak;
     Initialize();
     CheckState();
 }
コード例 #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);
        }
コード例 #14
0
        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);
        }
コード例 #15
0
 public WellDone(double currentTemp, Steak steak)
 {
     this.currentTemp = currentTemp;
     this.steak       = steak;
     this.canEat      = true;
     Initialize();
 }
コード例 #16
0
 public MediumRare(double currentTemp, Steak steak)
 {
     this.currentTemp = currentTemp;
     this.streak      = steak;
     Initialize();
     CheckState();
 }
コード例 #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);
                }
            }
        }
コード例 #18
0
ファイル: SteakRepository.cs プロジェクト: vkwithluv/ReposSG
        // 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.
        }
コード例 #19
0
 public Uncooked(Steak meat)
 {
     steak       = meat;
     currentTemp = 0;
     lowerTemp   = 0;
     upperTemp   = 130;
     CanEat      = false;
 }
コード例 #20
0
        public Rare(double currentTemp, Steak steak)
        {
            _currentTemp = currentTemp;
            _steak       = steak;
            //We can now eat the steak
            _canEat = true;

            Initialize();
        }
コード例 #21
0
        public Uncooked(Steak steak, double currentTemperature)
        {
            _steak = steak;
            _currentTemperature = currentTemperature;

            _lowerTemperature = 0;
            _upperTemperature = 49;
            _isSafeToEat      = false;
        }
コード例 #22
0
ファイル: SteakView.cs プロジェクト: vkwithluv/ReposSG
        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);
        }
コード例 #23
0
ファイル: SteakController.cs プロジェクト: vkwithluv/ReposSG
        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);
        }
コード例 #24
0
ファイル: AnimalTests.cs プロジェクト: kament/Team-Peach
        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();
        }
コード例 #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();
        }
コード例 #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);
            }
コード例 #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);
        }
コード例 #28
0
ファイル: Program.cs プロジェクト: A9dr8weed/State
        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);
        }
コード例 #29
0
ファイル: SteakRepository.cs プロジェクト: vkwithluv/ReposSG
        // 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
        }
コード例 #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);
        }