Advertisement
Guest User

Untitled

a guest
Nov 21st, 2015
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.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 _03.PC_Catalog
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. Components processor = new Components("Intel", 300);
  14. Components motherboard = new Components("Gygabyte", 150);
  15. Components ram = new Components("Kingston", 70);
  16. Components hdd = new Components("SATA", 100);
  17. Components graphicCard = new Components("Nvidia", 400);
  18.  
  19. Computer computer = new Computer("Deluxe", processor, motherboard, ram, hdd, graphicCard);
  20.  
  21. computer.TotalPrice();
  22. computer.PrintComputer();
  23.  
  24.  
  25. List<Computer> computers = new List<Computer>();
  26. computers.Add(new Computer("Deluxe", new Components("Intel", 300), new Components("Gygabyte", 150), new Components("Kingston", 70), new Components("SATA", 120), new Components("Nvidia", 400)));
  27. computers.Add(new Computer("Dell", new Components("AMD", 250), new Components("asrock", 250), new Components("Kingston", 170), new Components("SATA", 220), new Components("PowerColor", 600)));
  28. computers.Add(new Computer("Asus", new Components("XEON", 600), new Components("asus", 350), new Components("Kingston", 90), new Components("SATA", 90), new Components("Saphire", 300)));
  29. computers.Add(new Computer("Toshiba", new Components("Intel", 300), new Components("Gygabyte", 200), new Components("Kingston", 120), new Components("SATA", 120), new Components("Radeon7", 1000)));
  30.  
  31. foreach (var comp in computers)
  32. {
  33. comp.TotalPrice();
  34. }
  35.  
  36. computers.OrderByDescending(comp => comp.Price).ToList().ForEach(comp => Console.WriteLine("{0} - {1}", comp.Name, comp.Price));
  37.  
  38.  
  39. }
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement