rado8506

Transport price

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