Advertisement
Gillito

Untitled

Jun 8th, 2015
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.46 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApplication35
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             CPU cp1 = new CPU("Intel", 2800);
  14.             GPU gp1 = new GPU("Radeon", 1024);
  15.             DDR ddr1 = new DDR("DDR2", 2048);
  16.             MB mb1 = new MB("P5QC", 1333);
  17.  
  18.             Computer setup1 = new Computer(cp1, gp1, ddr1, mb1);
  19.             Console.WriteLine(setup1.GetTotalIndex());
  20.         }
  21.     }
  22.  
  23.     class Computer
  24.     {
  25.         public CPU cpu;
  26.         public GPU gpu;
  27.         public DDR ddr;
  28.         public MB mb;
  29.  
  30.         public Computer(CPU cp, GPU gp, DDR ram, MB board)
  31.         {
  32.             cpu = cp;
  33.             gpu = gp;
  34.             ddr = ram;
  35.             mb = board;
  36.         }
  37.  
  38.         public int GetTotalIndex()
  39.         {
  40.             int indexCP = 0;
  41.             if (cpu.perf >= 2000 & cpu.perf <= 2400)
  42.                 indexCP = 1;
  43.             else if (cpu.perf > 2400 & cpu.perf <= 2800)
  44.                 indexCP = 2;
  45.             else if (cpu.perf > 2800 & cpu.perf <= 3200)
  46.                 indexCP = 3;
  47.             else if (cpu.perf > 3200 & cpu.perf <= 3600)
  48.                 indexCP = 4;
  49.             else if (cpu.perf > 3600)
  50.                 indexCP = 5;
  51.  
  52.             int indexGP = 0;
  53.             if (gpu.perf >= 256 & gpu.perf <= 512)
  54.                 indexGP = 1;
  55.             else if (gpu.perf > 512 & gpu.perf < 1024)
  56.                 indexGP = 2;
  57.             else if (gpu.perf == 1024)
  58.                 indexGP = 3;
  59.             else if (gpu.perf > 1024 & gpu.perf <= 2048)
  60.                 indexGP = 4;
  61.             else if (gpu.perf > 2048)
  62.                 indexGP = 5;
  63.  
  64.             int indexRAM = 0;
  65.             if (ddr.perf <=1024)
  66.                 indexRAM = 1;
  67.             else if (ddr.perf > 1024 & ddr.perf <= 2048)
  68.                 indexRAM = 2;
  69.             else if (ddr.perf > 2048 & ddr.perf < 4096)
  70.                 indexRAM = 3;
  71.             else if (ddr.perf >= 4096 & ddr.perf < 8192)
  72.                 indexRAM = 4;
  73.             else if (ddr.perf > 8192)
  74.                 indexRAM = 5;
  75.  
  76.             int indexMB = 0;
  77.             if (mb.perf == 800)
  78.                 indexMB = 1;
  79.             else if (mb.perf > 800 & mb.perf < 966)
  80.                 indexMB = 2;
  81.             else if (mb.perf >=966 & mb.perf <= 1112)
  82.                 indexMB = 3;
  83.             else if (mb.perf > 1112 & mb.perf < 1333)
  84.                 indexMB = 4;
  85.             else if (mb.perf == 1333)
  86.                 indexMB = 5;
  87.  
  88.             int total = indexCP + indexGP + indexRAM + indexMB;
  89.  
  90.             return total;
  91.         }
  92.     }
  93.  
  94.     class CPU
  95.     {
  96.         public string title;
  97.         public int perf;
  98.  
  99.         public CPU(string t, int p)
  100.         {
  101.             title = t;
  102.             perf = p;
  103.         }
  104.     }
  105.  
  106.     class GPU
  107.     {
  108.         public string title;
  109.         public int perf;
  110.  
  111.         public GPU(string t, int p)
  112.         {
  113.             title = t;
  114.             perf = p;
  115.         }
  116.     }
  117.  
  118.     class DDR
  119.     {
  120.         public string title;
  121.         public int perf;
  122.  
  123.         public DDR(string t, int p)
  124.         {
  125.             title = t;
  126.             perf = p;
  127.         }
  128.     }
  129.  
  130.     class MB
  131.     {
  132.         public string title;
  133.         public int perf;
  134.  
  135.         public MB(string t, int p)
  136.         {
  137.             title = t;
  138.             perf = p;
  139.         }
  140.     }
  141.  
  142.  
  143. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement