Advertisement
petrova

Transport Price

Nov 15th, 2016
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.71 KB | None | 0 0
  1. using System;
  2.  
  3. class Program
  4. {
  5.     static void Main()
  6.     {
  7.         var km = Double.Parse(Console.ReadLine());
  8.         var daytime = Console.ReadLine();
  9.         double price = 0;
  10.         if (km < 20)
  11.         {
  12.             if (daytime == "day")
  13.             {
  14.                 price = 0.70 + (0.79 * km);
  15.                 Console.WriteLine(price);
  16.             }
  17.             else if (daytime == "night")
  18.             {
  19.                 price = 0.70 + (km * 0.9);
  20.  
  21.             }
  22.         }
  23.         else if (km >= 20 && km < 100)
  24.         {
  25.             price = 0.09 * km;
  26.  
  27.         }
  28.         else if (km >= 100)
  29.         {
  30.             price = 0.06 * km;
  31.  
  32.         }
  33.  
  34.         Console.WriteLine(price);
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement