public double CalculateTotalIncome() { double smallFactoryIncome = SmallFactory.CalculateTotalIncome(); double bigFactoryIncome = BigFactory.CalculateTotalIncome(); return(Math.Max(smallFactoryIncome, bigFactoryIncome) * PositiveProbability); }
private static List <IHaveStrategy> GetStrategies() { var value = ReadNumberForTaskFromFile(); var bigFactory = new BigFactory() { Cost = Convert.ToInt32(value[0]), Income = Convert.ToInt32(value[1]), GoodProbability = Convert.ToDouble(value[2]), Loss = Convert.ToInt32(value[3]), BadProbability = Convert.ToDouble(value[4]), Years = 5 }; var smallFactory = new SmallFactory() { Cost = Convert.ToInt32(value[5]), Income = Convert.ToInt32(value[6]), GoodProbability = Convert.ToDouble(value[7]), Loss = Convert.ToInt32(value[8]), BadProbability = Convert.ToDouble(value[9]), Years = 5 }; var waitOneYear = new WaitOneYear() { BigFactory = new BigFactory() { Cost = Convert.ToInt32(value[0]), Income = Convert.ToInt32(value[1]), GoodProbability = Convert.ToDouble(value[12]), Loss = Convert.ToInt32(value[3]), BadProbability = Convert.ToDouble(value[13]), Years = 4 }, SmallFactory = new SmallFactory() { Cost = Convert.ToInt32(value[5]), Income = Convert.ToInt32(value[6]), GoodProbability = Convert.ToDouble(value[12]), Loss = Convert.ToInt32(value[8]), BadProbability = Convert.ToDouble(value[13]), Years = 4 }, PositiveProbability = Convert.ToDouble(value[10]), NegativeProbability = Convert.ToDouble(value[11]) }; return(new List <IHaveStrategy> { bigFactory, smallFactory, waitOneYear }); }