public MediumRare(double currentTemp, Steak steak) { this.currentTemp = currentTemp; this.steak = steak; canEat = true; Initialize(); }
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(); }
public Medium(double currentTemp, Steak steak) { _currentTemp = currentTemp; _steak = steak; _canEat = true; Initialize(); }
// 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); }
private static void CreateSteak() { Steak mySteak = SteakView.GetNewSteakData(); SteakRepository.Create(mySteak); SteakView.DisplaySteak(mySteak); }
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(); }
private static void SearchSteaks() { int steakId = SteakView.SearchSteak(); Steak mySteak = SteakRepository.ListById(steakId); SteakView.DisplaySteak(mySteak); }
public Ruined(double currentTemp, Steak steak) { this.currentTemp = currentTemp; this.steak = steak; canEat = true; Initialize(); }
public Rare(double currentTemp, Steak steak) { this.currentTemp = currentTemp; this.steak = steak; canEat = true; //We can now eat the steak Initialize(); }
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(); }
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); }
public WellDone(double currentTemp, Steak steak) { this.currentTemp = currentTemp; this.steak = steak; this.canEat = true; Initialize(); }
public MediumRare(double currentTemp, Steak steak) { this.currentTemp = currentTemp; this.streak = steak; Initialize(); CheckState(); }
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); } } }
// 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. }
public Uncooked(Steak meat) { steak = meat; currentTemp = 0; lowerTemp = 0; upperTemp = 130; CanEat = false; }
public Rare(double currentTemp, Steak steak) { _currentTemp = currentTemp; _steak = steak; //We can now eat the steak _canEat = true; Initialize(); }
public Uncooked(Steak steak, double currentTemperature) { _steak = steak; _currentTemperature = currentTemperature; _lowerTemperature = 0; _upperTemperature = 49; _isSafeToEat = false; }
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); }
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); }
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(); }
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(); }
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); }
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); }
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); }
// 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 }
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); }