示例#1
0
        private static void MakeTouareg()
        {
            Tea baseTea = null;

            foreach (var line in File.ReadAllLines(batchFile))
            {
                var teas = line.Split(new string[] { ", " }, StringSplitOptions.None);

                if (teas[1].ToUpper() == "WATER")
                {
                    baseTea = new Tea(teas[0])
                    {
                        UserBrewingTime = double.Parse(teas[3]),
                        UserBrewingTemp = double.Parse(teas[2])
                    };
                }
                else
                {
                    if (baseTea != null)
                    {
                        Touareg touareg = new Touareg(teas[0])
                        {
                            BaseOfTea = baseTea
                        };
                        var result = touareg.PrepareTea(double.Parse(teas[2]), double.Parse(teas[3]));
                        Console.WriteLine(result);

                        SaveFile(result6, new[] { result });
                        Console.WriteLine($"Files was saved in {AppDomain.CurrentDomain.BaseDirectory}");
                    }
                }
            }
        }
示例#2
0
        protected override Car CreateCar(string type)
        {
            Car             car     = null;
            CarPartsFactory factory = new DeutschCarPartsFactory();

            if (type == "Golf")
            {
                car = new Golf(factory);
            }
            else if (type == "Passat")
            {
                car = new Passat(factory);
            }
            else if (type == "Tiguan")
            {
                car = new Tiguan(factory);
            }
            else if (type == "Touareg")
            {
                car = new Touareg(factory);
            }

            return(car);
        }