Advertisement
spasnikolov131

Untitled

May 9th, 2021
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Transport_Price
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. int n = int.Parse(Console.ReadLine());
  10. string dayOrNight = Console.ReadLine().ToString();
  11. double taxi = 0.70;
  12. double bus = 0.09;
  13. double train = 0.06;
  14. double taxiday = 0.79;
  15. double taxiNight = 0.90;
  16. if (n <= 20 && dayOrNight == "day") // taxi
  17. {
  18.  
  19. Console.WriteLine($"{taxi + (n * taxiday):f2}");
  20. }
  21. else if (n <= 20 && dayOrNight == "night")
  22. {
  23.  
  24. Console.WriteLine($"{((n * taxiNight) + taxi):f2}");
  25. }
  26. else if (n >= 20 && dayOrNight == "day")
  27. {
  28.  
  29. Console.WriteLine($"{(n * bus):f2}");
  30. }
  31. else if (n >= 100)
  32. {
  33.  
  34. Console.WriteLine($"{(n * train):f2}");
  35. }
  36. else
  37. {
  38. Console.WriteLine("Invalid");
  39. }
  40.  
  41. }
  42. }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement