Advertisement
plamen27

Transport Price

Jun 27th, 2016
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 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.  
  16.  
  17. double taxi=double.MaxValue ;
  18. double bus=double.MaxValue ;
  19. double train=double.MaxValue ;
  20. double price = 0;
  21.  
  22.  
  23. if (dayOrNight == "day")
  24. {
  25.  
  26. taxi = 0.70 + (n * 0.79);
  27. Console.WriteLine(taxi);
  28.  
  29. }
  30.  
  31.  
  32. else if (dayOrNight == "night")
  33. {
  34.  
  35. taxi= (0.70 + 0.90 * n);
  36. }
  37. if (n >= 20)
  38. {
  39. bus = n * 0.09;
  40.  
  41. }
  42. if (n >= 100)
  43. {
  44. train = 0.06 * n;
  45.  
  46. }
  47.  
  48. price = Math.Min(Math.Min(taxi, bus),train);
  49. Console.WriteLine(price);
  50. }
  51.  
  52.  
  53. }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement