Advertisement
Gillito

Untitled

Jun 8th, 2015
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.91 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.  
  20.             Console.WriteLine(cp1.GetIndexCP());
  21.             Console.WriteLine(gp1.GetIndexGP());
  22.             Console.WriteLine(ddr1.GetIndexRAM());
  23.             Console.WriteLine(mb1.GetIndexMB());
  24.  
  25.             Console.WriteLine(setup1.GetTotalIndex());
  26.         }
  27.     }
  28.  
  29.     class Computer
  30.     {
  31.         public CPU cpu;
  32.         public GPU gpu;
  33.         public DDR ddr;
  34.         public MB mb;
  35.  
  36.         public Computer(CPU cp, GPU gp, DDR ram, MB board)
  37.         {
  38.             cpu = cp;
  39.             gpu = gp;
  40.             ddr = ram;
  41.             mb = board;
  42.         }
  43.  
  44.         public int GetTotalIndex()
  45.         {
  46.             int total = cpu.GetIndexCP() + gpu.GetIndexGP() + ddr.GetIndexRAM() + mb.GetIndexMB();
  47.             return total;
  48.         }
  49.     }
  50.  
  51.     class CPU
  52.     {
  53.         public string title;
  54.         public int perf;
  55.  
  56.         public CPU(string t, int p)
  57.         {
  58.             title = t;
  59.             perf = p;
  60.         }
  61.  
  62.         public int GetIndexCP()
  63.         {
  64.             int indexCP = 0;
  65.             if (perf >= 2000 & perf <= 2400)
  66.                 indexCP = 1;
  67.             else if (perf > 2400 & perf <= 2800)
  68.                 indexCP = 2;
  69.             else if (perf > 2800 & perf <= 3200)
  70.                 indexCP = 3;
  71.             else if (perf > 3200 & perf <= 3600)
  72.                 indexCP = 4;
  73.             else if (perf > 3600)
  74.                 indexCP = 5;
  75.  
  76.             return indexCP;
  77.         }
  78.     }
  79.  
  80.     class GPU
  81.     {
  82.         public string title;
  83.         public int perf;
  84.  
  85.         public GPU(string t, int p)
  86.         {
  87.             title = t;
  88.             perf = p;
  89.         }
  90.  
  91.         public int GetIndexGP()
  92.         {
  93.             int indexGP = 0;
  94.             if (perf >= 256 & perf <= 512)
  95.                 indexGP = 1;
  96.             else if (perf > 512 & perf < 1024)
  97.                 indexGP = 2;
  98.             else if (perf == 1024)
  99.                 indexGP = 3;
  100.             else if (perf > 1024 & perf <= 2048)
  101.                 indexGP = 4;
  102.             else if (perf > 2048)
  103.                 indexGP = 5;
  104.  
  105.             return indexGP;
  106.         }
  107.     }
  108.  
  109.     class DDR
  110.     {
  111.         public string title;
  112.         public int perf;
  113.  
  114.         public DDR(string t, int p)
  115.         {
  116.             title = t;
  117.             perf = p;
  118.         }
  119.  
  120.         public int GetIndexRAM()
  121.         {
  122.             int indexRAM = 0;
  123.             if (perf <= 1024)
  124.                 indexRAM = 1;
  125.             else if (perf > 1024 & perf <= 2048)
  126.                 indexRAM = 2;
  127.             else if (perf > 2048 & perf < 4096)
  128.                 indexRAM = 3;
  129.             else if (perf >= 4096 & perf < 8192)
  130.                 indexRAM = 4;
  131.             else if (perf > 8192)
  132.                 indexRAM = 5;
  133.  
  134.             return indexRAM;
  135.         }
  136.     }
  137.  
  138.     class MB
  139.     {
  140.         public string title;
  141.         public int perf;
  142.  
  143.         public MB(string t, int p)
  144.         {
  145.             title = t;
  146.             perf = p;
  147.         }
  148.  
  149.         public int GetIndexMB()
  150.         {
  151.             int indexMB = 0;
  152.             if (perf == 800)
  153.                 indexMB = 1;
  154.             else if (perf > 800 & perf < 966)
  155.                 indexMB = 2;
  156.             else if (perf >= 966 & perf <= 1112)
  157.                 indexMB = 3;
  158.             else if (perf > 1112 & perf < 1333)
  159.                 indexMB = 4;
  160.             else if (perf == 1333)
  161.                 indexMB = 5;
  162.  
  163.             return indexMB;
  164.         }
  165.     }
  166.  
  167.  
  168. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement