Computer(ProcessorType _processorType, NameManufacturer _nameManufacturer, TypeOfOperatingSystem _typeOfOperatingSystem, int _processClockSpeed, int _amountOfRAM, List <string> _InstalledSoftware, List <string> _UsersOfSystem) { InstalledSoftware = new List <string>(); UsersOfSystem = new List <string>(); processorType = _processorType; nameManufacturer = _nameManufacturer; typeOfOperatingSystem = _typeOfOperatingSystem; processClockSpeed = _processClockSpeed; amountOfRAM = _amountOfRAM; InstalledSoftware = _InstalledSoftware; UsersOfSystem = _UsersOfSystem; }
public Manufacter(NameManufacturer _name, Countries _country, int _countOfWorker) { name = _name; country = _country; countOfWorker = _countOfWorker; }
public static string queryComputersByNameManufacterInfo(NameManufacturer nameManufacturer, List <string> InstalledSoftware, Countries country, int countOfWorker) { return(string.Format("{0,5} {1,13} {2,10} countOfWorker = {3,5} ", nameManufacturer, GetInstalledSoftware(InstalledSoftware), country, countOfWorker)); }
//метод, создающий один экземпляр класса public static Computer Generate() { Random rnd = new Random(); ProcessorType _processorType = (ProcessorType)rnd.Next(4); NameManufacturer _nameManufacturer = (NameManufacturer)rnd.Next(3); TypeOfOperatingSystem _typeOfOperatingSystem = (TypeOfOperatingSystem)rnd.Next(4); int _processClockSpeed = rnd.Next(100, 1000); int _amountOfRAM = 0; int _amount = rnd.Next(4); switch (_amount) { case 0: _amountOfRAM = 2; break; case 1: _amountOfRAM = 4; break; case 2: _amountOfRAM = 8; break; case 3: _amountOfRAM = 16; break; } List <string> _InstalledSoftware = new List <string>(); int _installedSoftware1 = rnd.Next(3); switch (_installedSoftware1) { case 0: _InstalledSoftware.Add("Windows"); break; case 1: _InstalledSoftware.Add("MAC"); break; case 2: _InstalledSoftware.Add("Linux"); break; } int _installedSoftware2 = rnd.Next(6); if (_installedSoftware1 != _installedSoftware2) { switch (_installedSoftware2) { case 0: _InstalledSoftware.Add("Windows"); break; case 1: _InstalledSoftware.Add("MAC"); break; case 2: _InstalledSoftware.Add("Linux"); break; } } List <string> _UsersOfSystem = new List <string>(); int _usersOfSystem1 = rnd.Next(6); switch (_usersOfSystem1) { case 0: _UsersOfSystem.Add("Хрулев"); break; case 1: _UsersOfSystem.Add("Бухалов"); break; case 2: _UsersOfSystem.Add("Рогожина"); break; case 3: _UsersOfSystem.Add("Досаева"); break; case 4: _UsersOfSystem.Add("Лукин"); break; case 5: _UsersOfSystem.Add("Янцен"); break; } int _usersOfSystem2 = rnd.Next(12); if (_usersOfSystem1 != _usersOfSystem2) { switch (_usersOfSystem2) { case 0: _UsersOfSystem.Add("Хрулев"); break; case 1: _UsersOfSystem.Add("Бухалов"); break; case 2: _UsersOfSystem.Add("Рогожина"); break; case 3: _UsersOfSystem.Add("Досаева"); break; case 4: _UsersOfSystem.Add("Лукин"); break; case 5: _UsersOfSystem.Add("Янцен"); break; } } return(new Computer(_processorType, _nameManufacturer, _typeOfOperatingSystem, _processClockSpeed, _amountOfRAM, _InstalledSoftware, _UsersOfSystem)); }