Advertisement
Guest User

Transport price

a guest
Sep 24th, 2016
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 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 TransportPrice
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. int n = int.Parse(Console.ReadLine());
  14. string dayOrNight = Console.ReadLine();
  15. double taxi = 0;
  16. double bus = 0;
  17. double train = 0;
  18.  
  19. switch (dayOrNight)
  20. {
  21. case "day":
  22. if (n >= 20 && n <= 99)
  23. {
  24. Console.WriteLine(bus += 0.09 * n);
  25. }
  26. else if (n >= 100)
  27. {
  28. Console.WriteLine(train += 0.06 * n);
  29. }
  30. else
  31. {
  32. Console.WriteLine(taxi += 0.7 + 0.79 * n);
  33. }
  34. break;
  35.  
  36. case "night":
  37. if (n >= 20 && n <= 99)
  38. {
  39. Console.WriteLine(bus += 0.09 * n);
  40. }
  41. else if (n >= 100)
  42. {
  43. Console.WriteLine(train += 0.06 * n);
  44. }
  45. else
  46. {
  47. Console.WriteLine(taxi += 0.7 + 0.90 * n);
  48. }
  49. break;
  50. }
  51. }
  52. }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement