Advertisement
Guest User

Untitled

a guest
Oct 19th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.50 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 MiningSystem
  8. {
  9. class SystemManager
  10. {
  11. public double TotalStoredEnergy { get;
  12. private set; }
  13. public double TotalMinedCoal { get;
  14. private set; }
  15.  
  16. Dictionary<string, Miner> miners =
  17. new Dictionary<string, Miner>();
  18.  
  19. Dictionary<string, Provider> providers =
  20. new Dictionary<string, Provider>();
  21.  
  22. public string RegisterHarvester(List<string> arguments)
  23. {
  24. string type = arguments[0];
  25. string id = arguments[1];
  26. double coalOutput =
  27. double.Parse(arguments[2]);
  28. double energyRequirement =
  29. double.Parse(arguments[3]);
  30.  
  31. Miner miner = null;
  32. if (type == "Hewer")
  33. {
  34. int enduranceFactor =
  35. int.Parse(arguments[4]);
  36. miner = new Hewer(id, coalOutput,
  37. energyRequirement,
  38. enduranceFactor);
  39. }
  40. else
  41. {
  42. miner = new Driller(id, coalOutput,
  43. energyRequirement);
  44. }
  45.  
  46. if (miners.ContainsKey(id)==false)
  47. {
  48. //not such miner, create new miner:
  49. miners.Add(id, miner);
  50. }
  51.  
  52. return "Successfully registered "
  53. + type +" Miner – "+id;
  54. }
  55.  
  56. public string RegisterProvider(List<string> arguments)
  57. {
  58. string type = arguments[0];
  59. string id = arguments[1];
  60. double energyOutput =
  61. double.Parse(arguments[2]);
  62.  
  63. Provider provider = null;
  64. if (type == "Sun")
  65. {
  66. provider =
  67. new SunProvider(id, energyOutput);
  68. }
  69. else
  70. {
  71. provider =
  72. new ElectricityProvider(id, energyOutput);
  73. }
  74.  
  75. if (providers.ContainsKey(id)==false)
  76. {
  77. providers.Add(id, provider);
  78. }
  79.  
  80. return "Successfully registered "+ type +" Provider – "+id;
  81. }
  82.  
  83. public string Day()
  84. {
  85. }
  86.  
  87. public string Check(List<string> arguments)
  88. {
  89. }
  90.  
  91. public string ShutDown()
  92. {
  93.  
  94. }
  95. }
  96. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement