public bool CheckRequirements(TextEditor te, Game game, HardDrive hardDrive, RAM ram, GPU gpu) { if (te != null) { if (ram.totalGigs >= te.requiredRAM && hardDrive.availableStorage >= te.requiredStorage) { return(true); } else { return(false); } } else if (game != null) { if (ram.totalGigs >= game.requiredRAM && hardDrive.availableStorage >= game.requiredStorage && gpu.effectiveMemory >= game.requiredEffectiveMemory) { return(true); } else { return(false); } } else { return(false); } }
// Constructor public Motherboard(string manufacturer, RAM ram, CPU cpu, HardDrive hardDrive, GPU gpu) { this.manufacturer = manufacturer; this.tempMemory = ram; this.processor = cpu; this.storage = hardDrive; this.graphics = gpu; }
// Constructor public Computer() { cpu = new CPU("Intel", "i7 6th gen"); gpu = new GPU("Radeon", 16); hdd = new HardDrive(1000, 988); ram = new RAM(16, "Some cool brand you've never heard of"); mb = new Motherboard("ASUS", ram, cpu, hdd, gpu); }
// Member methods public void InstallApplication(TextEditor te, Game game, HardDrive hardDrive, RAM ram, GPU gpu) { if (CheckRequirements(te, game, hardDrive, ram, gpu)) { if (te == null) { hardDrive.applications.Add(game); hardDrive.ConsumeStorage(game.requiredStorage); } else { hardDrive.applications.Add(te); hardDrive.ConsumeStorage(te.requiredStorage); } } else { Console.WriteLine("You do not have enough resources to install this applicaiton."); } }