Advertisement
KeepCoding

TransportPrice

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