Esempio n. 1
0
 public GroundTransport()
 {
     fuelConsumption = 33;
     ticketsQuantity = 77;
     try
     {
         OilPrices oilprices = new OilPrices(FilesDirectories.OilPrices);
     }
     catch (Exception)
     {
         throw new Exception("Error reading oil prices from file");
     }
     fuelprice = OilPrices.getPrice("Уголь");
 }
Esempio n. 2
0
 public WaterTranport()
 {
     fuelConsumption = 100;
     ticketsQuantity = 20;
     try
     {
         OilPrices oilprices = new OilPrices(FilesDirectories.OilPrices);
     }
     catch (Exception)
     {
         throw new Exception("Eror reading oil prices from file");
     }
     fuelprice = OilPrices.getPrice("Солярка");
 }
Esempio n. 3
0
 /// <summary>
 /// Расчёт стоимости проезда из пункта 1 в пункт 2
 /// </summary>
 /// <param name="from">Откуда</param>
 /// <param name="to">Куда</param>
 /// <returns>Стоимость</returns>
 /// <exception cref="System.Exception">Ошибка расчёта расстояния между пунктами</exception>"
 /// <exception cref="System.Exception">Ошибка чтения цен топлива из файла</exception>"
 public override double cost(string from, string to)
 {
     //string mapPath;//Куда всунуть path или саму map. В параметры cost или локальными переменными cost?
     AirMap map = new AirMap(FilesDirectories.AirMap);
     double distance;
     try
     {
         distance = map.Distance(from, to);
     }
     catch (Exception)
     {
         throw new Exception("2 airports doesn't communicate");
     }
     try
     {
         OilPrices oilprice = new OilPrices(FilesDirectories.OilPrices);
     }
     catch (Exception)
     {
         throw new Exception("Error reading oil prices");
     }
     return fuelConsumption * OilPrices.getPrice(oilType) * distance / ticketsQuantity;//Можно добавить +luggage+takeoff+посадка
 }