Advertisement
Guest User

Untitled

a guest
Jan 28th, 2020
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.59 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 ConsoleApp4
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. PC pc = new PcBuilder()
  14. .AddCPU("Ryzen 5 2600")
  15. .AddGPU("GTX 1060 6GB")
  16. .AddRAM("Crucial Ballistix Tactical 3000 MHz")
  17. .AddDysk("Toshiba P3000 7200 obr ")
  18. .AddObudowa("SilentiumPC Signum SG1")
  19. .Build();
  20.  
  21. Console.ReadKey();
  22. }
  23. }
  24. public class PC
  25. {
  26. public string AddCPU { get; set; }
  27. public string AddGPU { get; set; }
  28. public string AddRAM { get; set; }
  29. public string AddObudowa { get; set; }
  30. public string AddDysk { get; set; }
  31. }
  32. class PcBuilder
  33. {
  34. PC pc = new PC();
  35. public PcBuilder AddCPU(string CPU)
  36. {
  37. pc.AddCPU = CPU;
  38. return this;
  39. }
  40. public PcBuilder AddGPU(string GPU)
  41. {
  42. pc.AddGPU = GPU;
  43. return this;
  44. }
  45. public PcBuilder AddRAM (string RAM)
  46. {
  47. pc.AddRAM = RAM;
  48. return this;
  49. }
  50. public PcBuilder AddObudowa(string obudowa)
  51. {
  52. pc.AddObudowa = obudowa;
  53. return this;
  54. }
  55. public PcBuilder AddDysk(string dysk)
  56. {
  57. pc.AddDysk = dysk;
  58. return this;
  59. }
  60. public PC Build()
  61. {
  62. return pc;
  63. }
  64. }
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement