Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApplication35
- {
- class Program
- {
- static void Main(string[] args)
- {
- CPU cp1 = new CPU("Intel", 2800);
- GPU gp1 = new GPU("Radeon", 1024);
- DDR ddr1 = new DDR("DDR2", 2048);
- MB mb1 = new MB("P5QC", 1333);
- Computer setup1 = new Computer(cp1, gp1, ddr1, mb1);
- Console.WriteLine(cp1.GetIndexCP());
- Console.WriteLine(gp1.GetIndexGP());
- Console.WriteLine(ddr1.GetIndexRAM());
- Console.WriteLine(mb1.GetIndexMB());
- Console.WriteLine(setup1.GetTotalIndex());
- }
- }
- class Computer
- {
- public CPU cpu;
- public GPU gpu;
- public DDR ddr;
- public MB mb;
- public Computer(CPU cp, GPU gp, DDR ram, MB board)
- {
- cpu = cp;
- gpu = gp;
- ddr = ram;
- mb = board;
- }
- public int GetTotalIndex()
- {
- int total = cpu.GetIndexCP() + gpu.GetIndexGP() + ddr.GetIndexRAM() + mb.GetIndexMB();
- return total;
- }
- }
- class CPU
- {
- public string title;
- public int perf;
- public CPU(string t, int p)
- {
- title = t;
- perf = p;
- }
- public int GetIndexCP()
- {
- int indexCP = 0;
- if (perf >= 2000 & perf <= 2400)
- indexCP = 1;
- else if (perf > 2400 & perf <= 2800)
- indexCP = 2;
- else if (perf > 2800 & perf <= 3200)
- indexCP = 3;
- else if (perf > 3200 & perf <= 3600)
- indexCP = 4;
- else if (perf > 3600)
- indexCP = 5;
- return indexCP;
- }
- }
- class GPU
- {
- public string title;
- public int perf;
- public GPU(string t, int p)
- {
- title = t;
- perf = p;
- }
- public int GetIndexGP()
- {
- int indexGP = 0;
- if (perf >= 256 & perf <= 512)
- indexGP = 1;
- else if (perf > 512 & perf < 1024)
- indexGP = 2;
- else if (perf == 1024)
- indexGP = 3;
- else if (perf > 1024 & perf <= 2048)
- indexGP = 4;
- else if (perf > 2048)
- indexGP = 5;
- return indexGP;
- }
- }
- class DDR
- {
- public string title;
- public int perf;
- public DDR(string t, int p)
- {
- title = t;
- perf = p;
- }
- public int GetIndexRAM()
- {
- int indexRAM = 0;
- if (perf <= 1024)
- indexRAM = 1;
- else if (perf > 1024 & perf <= 2048)
- indexRAM = 2;
- else if (perf > 2048 & perf < 4096)
- indexRAM = 3;
- else if (perf >= 4096 & perf < 8192)
- indexRAM = 4;
- else if (perf > 8192)
- indexRAM = 5;
- return indexRAM;
- }
- }
- class MB
- {
- public string title;
- public int perf;
- public MB(string t, int p)
- {
- title = t;
- perf = p;
- }
- public int GetIndexMB()
- {
- int indexMB = 0;
- if (perf == 800)
- indexMB = 1;
- else if (perf > 800 & perf < 966)
- indexMB = 2;
- else if (perf >= 966 & perf <= 1112)
- indexMB = 3;
- else if (perf > 1112 & perf < 1333)
- indexMB = 4;
- else if (perf == 1333)
- indexMB = 5;
- return indexMB;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement