static Laptop CreateLaptop() { Battery battery = Config.GetBatteries().ElementAt(SelectComponent("Select Battery:", Config.GetBatteries())); CPU cpu = Config.GetCPUs().ElementAt(SelectComponent("Select CPU:", Config.GetCPUs())); RAM ram = Config.GetRAMs().ElementAt(SelectComponent("Select RAM:", Config.GetRAMs())); SSD ssd = Config.GetSSDs().ElementAt(SelectComponent("Select SSD:", Config.GetSSDs())); DOS.OperatingSystem os = Config.GetOperatingSystems().ElementAt(SelectComponent("Select OS:", Config.GetOperatingSystems())); bool electricity = SelectFlag("Will new laptop have an electricity connection?[y / n]: "); bool network = SelectFlag("Will new laptop have an network connection?[y / n]: "); Console.Write("Name of laptop: "); Laptop laptop = Laptop.Builder .Battery(battery) .Title(Console.ReadLine()) .CPU(cpu) .RAM(ram) .ExternalStorage(ssd) .OperatingSystem(os) .HasElectricityConnection(electricity) .HasNetworkConnection(network) .Build() as Laptop; foreach (DOS.Program program in Config.GetPrograms()) { laptop.OperatingSystem.Install(program); } return(laptop); }
static Laptop CreateLaptop() { Battery battery = Config.GetBatteries().ElementAt(SelectComponent("Select Battery:", Config.GetBatteries())); CPU cpu = Config.GetCPUs().ElementAt(SelectComponent("Select CPU:", Config.GetCPUs())); RAM ram = Config.GetRAMs().ElementAt(SelectComponent("Select RAM:", Config.GetRAMs())); SSD ssd = Config.GetSSDs().ElementAt(SelectComponent("Select SSD:", Config.GetSSDs())); DOS.OperatingSystem os = Config.GetOperatingSystems().ElementAt(SelectComponent("Select OS:", Config.GetOperatingSystems())); bool electricity = SelectFlag("Will new laptop have an electricity connection?[y / n]: "); bool network = SelectFlag("Will new laptop have an network connection?[y / n]: "); Console.Write("Name of laptop: "); Laptop laptop = new Laptop(Console.ReadLine(), cpu, battery, ram, ssd, os, electricity, network); foreach (DOS.Program program in Config.GetPrograms()) { laptop.OperatingSystem.Install(program); } return(laptop); }