Advertisement
Gillito

Untitled

Jun 8th, 2015
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.13 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.             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.             return indexCP;
  53.         }
  54.     }
  55.  
  56.     class CPU
  57.     {
  58.         public string title;
  59.         public int perf;
  60.  
  61.         public CPU(string t, int p)
  62.         {
  63.             title = t;
  64.             perf = p;
  65.         }
  66.     }
  67.  
  68.     class GPU
  69.     {
  70.         public string title;
  71.         public int perf;
  72.  
  73.         public GPU(string t, int p)
  74.         {
  75.             title = t;
  76.             perf = p;
  77.         }
  78.     }
  79.  
  80.     class DDR
  81.     {
  82.         public string title;
  83.         public int perf;
  84.  
  85.         public DDR(string t, int p)
  86.         {
  87.             title = t;
  88.             perf = p;
  89.         }
  90.     }
  91.  
  92.     class MB
  93.     {
  94.         public string title;
  95.         public int perf;
  96.  
  97.         public MB(string t, int p)
  98.         {
  99.             title = t;
  100.             perf = p;
  101.         }
  102.     }
  103.  
  104.  
  105. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement