Advertisement
AlfaNight

Untitled

Sep 29th, 2020
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.93 KB | None | 0 0
  1. using System;
  2.  
  3. namespace TransportPrice
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int n = int.Parse(Console.ReadLine());
  10.             string dayOrNight = Console.ReadLine();
  11.  
  12.             double taxiDay = 0.70 + n * 0.79 ;
  13.             double taxiNight = 0.70 +n * 0.90;
  14.             double bussDayNight = 0.09;
  15.             double trainDayNight = 0.06;
  16.  
  17.             if (n <= 20 && dayOrNight == "day")
  18.             {
  19.                 Console.WriteLine(taxiDay);
  20.             }
  21.             else if (n <= 20 && dayOrNight == "night")
  22.             {
  23.                 Console.WriteLine($"{taxiNight:F2}");
  24.             }
  25.             else if (n >= 20 && n <= 100)
  26.             {
  27.                 Console.WriteLine(bussDayNight * n);
  28.             }
  29.             else if (n >= 100)
  30.             {
  31.                 Console.WriteLine($"{trainDayNight * n:F2}");
  32.             }
  33.         }
  34.     }
  35. }
  36.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement