Atanasov91

PriceToTransport

Jan 25th, 2018
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.10 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 ConsoleApp1
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             double km = double.Parse(Console.ReadLine());
  14.             string dayTime = Console.ReadLine();
  15.  
  16.             double taxiStrart = 0.70;
  17.             double dayTaxi = 0.79;
  18.             double nightTaxi = 0.90;
  19.             double bus = 0.09;
  20.             double train = 0.06;
  21.  
  22.             double result;
  23.  
  24.             if (km < 20 && dayTime == "day")
  25.             {
  26.                 result = (dayTaxi * km) + taxiStrart;
  27.             }
  28.             else if (km <= 20 && dayTime == "night")
  29.             {
  30.                 result = (nightTaxi * km) + taxiStrart;
  31.             }
  32.             else if (km > 20 && dayTime == "day")
  33.             {
  34.                 result = (bus * km);
  35.             }
  36.             else if (km > 100 && dayTime == "night")
  37.             {
  38.                 result = (train * km);
  39.             }
  40.             Console.WriteLine(result);
  41.  
  42.  
  43.         }
  44.  
  45.     }
  46. }
Add Comment
Please, Sign In to add comment