Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace MiningSystem
- {
- class SystemManager
- {
- public double TotalStoredEnergy { get;
- private set; }
- public double TotalMinedCoal { get;
- private set; }
- Dictionary<string, Miner> miners =
- new Dictionary<string, Miner>();
- Dictionary<string, Provider> providers =
- new Dictionary<string, Provider>();
- public string RegisterHarvester(List<string> arguments)
- {
- string type = arguments[0];
- string id = arguments[1];
- double coalOutput =
- double.Parse(arguments[2]);
- double energyRequirement =
- double.Parse(arguments[3]);
- Miner miner = null;
- if (type == "Hewer")
- {
- int enduranceFactor =
- int.Parse(arguments[4]);
- miner = new Hewer(id, coalOutput,
- energyRequirement,
- enduranceFactor);
- }
- else
- {
- miner = new Driller(id, coalOutput,
- energyRequirement);
- }
- if (miners.ContainsKey(id)==false)
- {
- //not such miner, create new miner:
- miners.Add(id, miner);
- }
- return "Successfully registered "
- + type +" Miner – "+id;
- }
- public string RegisterProvider(List<string> arguments)
- {
- string type = arguments[0];
- string id = arguments[1];
- double energyOutput =
- double.Parse(arguments[2]);
- Provider provider = null;
- if (type == "Sun")
- {
- provider =
- new SunProvider(id, energyOutput);
- }
- else
- {
- provider =
- new ElectricityProvider(id, energyOutput);
- }
- if (providers.ContainsKey(id)==false)
- {
- providers.Add(id, provider);
- }
- return "Successfully registered "+ type +" Provider – "+id;
- }
- public string Day()
- {
- }
- public string Check(List<string> arguments)
- {
- }
- public string ShutDown()
- {
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement