Advertisement
YavorJS

Transport_Price

Jun 20th, 2016
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 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 test
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13.  
  14. int km = int.Parse(Console.ReadLine());
  15. string dayNight = Console.ReadLine();
  16. decimal bestPrice = 0;
  17. decimal priceTaxi=decimal.MaxValue;
  18. decimal priceBus=decimal.MaxValue;
  19. decimal priceTrain=decimal.MaxValue;
  20. if (dayNight=="day")
  21. {
  22. priceTaxi = (decimal)(0.70 + 0.79 * km);
  23.  
  24. }
  25. else if (dayNight=="night")
  26. {
  27. priceTaxi= (decimal)(0.70 + 0.90 * km);
  28. }
  29. if (km >= 20)
  30. {
  31. priceBus = (decimal)(0.09 * km);
  32. }
  33. if (km >= 100)
  34. {
  35. priceTrain = (decimal)(0.06 * km);
  36. }
  37.  
  38. bestPrice = Math.Min(Math.Min(priceTaxi, priceBus),priceTrain);
  39. Console.WriteLine(bestPrice);
  40. }
  41. }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement