private static void CheckTheManufacturer(string manufacturer, ref PersonalComputer pc, ref Laptop laptop, ref Server server) { if (manufacturer == "HP") { var hpManufacturer = new HPManufacturer(); var factoryManager = new FactoryManager(hpManufacturer); pc = factoryManager.MakePersonalComputer(); laptop = factoryManager.MakeLaptop(); server = factoryManager.MakeServer(); } else if (manufacturer == "Dell") { var dellManufacturer = new DellManufacturer(); var factoryManager = new FactoryManager(dellManufacturer); pc = factoryManager.MakePersonalComputer(); laptop = factoryManager.MakeLaptop(); server = factoryManager.MakeServer(); } else if (manufacturer == "Lenovo") { var lenovoManufacturer = new LenovoManufacturer(); var factoryManager = new FactoryManager(lenovoManufacturer); pc = factoryManager.MakePersonalComputer(); laptop = factoryManager.MakeLaptop(); server = factoryManager.MakeServer(); } else { throw new ArgumentException("Invalid manufacturer!"); } }
private static void ExecuteCommand(PersonalComputer pc, Laptop laptop, Server server, string[] commandParameters) { var inputConsoleCommand = commandParameters[0]; var commandArgument = int.Parse(commandParameters[1]); if (inputConsoleCommand == "Charge") { string result = laptop.ChargeBattery(commandArgument); laptop.VideoCardOfComputer.Draw(result + "%"); } else if (inputConsoleCommand == "Process") { string result = server.Process(commandArgument); server.VideoCardOfComputer.Draw(result); } else if (inputConsoleCommand == "Play") { string result = pc.Play(commandArgument); pc.VideoCardOfComputer.Draw(result); } else { Console.WriteLine("Invalid command!"); } }
public override PersonalComputer MakePersonalComputer() { CPU cpu = new CPU(2, 64); RAM ram = new RAM(4); HardDrive hardDrive = new HardDrive(2000, false, 0); VideoCard videoCard = new VideoCard(true); PersonalComputer lenovoPersonalComputer = new PersonalComputer(cpu, ram, hardDrive, videoCard); return lenovoPersonalComputer; }
public override PersonalComputer MakePersonalComputer() { CPU cpu = new CPU(2, 32); RAM ram = new RAM(2); HardDrive hardDrive = new HardDrive(500, false, 0); VideoCard videoCard = new VideoCard(false); PersonalComputer hpPersonalComputer = new PersonalComputer(cpu, ram, hardDrive, videoCard); return hpPersonalComputer; }
public override PersonalComputer MakePersonalComputer() { CPU cpu = new CPU(4, 64); RAM ram = new RAM(8); HardDrive hardDrive = new HardDrive(1000, false, 0); VideoCard videoCard = new VideoCard(false); PersonalComputer dellPersonalComputer = new PersonalComputer(cpu, ram, hardDrive, videoCard); return dellPersonalComputer; }