Ejemplo n.º 1
0
        public int CalculateIncome()
        {
            var orderedPowerStations = PowerStations.OrderByDescending(p => p.Power);
            List <PowerStation> stationsThatCanBePowered = new List <PowerStation>();

            foreach (var powerStation in PowerStations)
            {
                if (CanPower(powerStation))
                {
                    stationsThatCanBePowered.Add(powerStation);
                }
            }
            return(stationsThatCanBePowered.Sum(p => p.Power));
        }
Ejemplo n.º 2
0
 public int GetBiggestPowerStation()
 {
     return(PowerStations.OrderByDescending(p => p.Value).FirstOrDefault()?.Value ?? 0);
 }