fbinnzhivko

02. Transport Price

Mar 15th, 2016
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.50 KB | None | 0 0
  1. using System;
  2.  
  3. class Program
  4. {
  5.     static void Main()
  6.     {
  7.         int miles = int.Parse(Console.ReadLine());
  8.         string time = Console.ReadLine();
  9.  
  10.         var total = 0.0;
  11.  
  12.         if (miles < 20 && miles >= 1)
  13.         {
  14.             if (time == "day") { total = 0.7 + miles * 0.79; }
  15.             else { total = 0.7 + miles * 0.90; }
  16.         }
  17.         else if (miles < 100) { total = miles * 0.09; }
  18.         else { total = miles * 0.06; }
  19.         Console.WriteLine(total);
  20.     }
  21. }
Add Comment
Please, Sign In to add comment