bacco

Ваканцията на Иванови: Ivanovi's Holiday;

Feb 6th, 2018
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.29 KB | None | 0 0
  1. using System;
  2.  
  3. namespace tESt
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             var nights = int.Parse(Console.ReadLine());      
  10.             var destenation = Console.ReadLine().ToLower();  // “Miami”, “Canary Islands”, “Philippines”.
  11.             var transport = Console.ReadLine().ToLower();    // “train”, “bus” или “airplane”
  12.  
  13.             double sumChildren = 0;
  14.             double sumAdults = 0;
  15.  
  16.             double sumdestanation = 0;
  17.             double sumTickets = 0;
  18.  
  19.             double sumTotal = 0;
  20.  
  21.             if (nights <= 10)
  22.             {
  23.                 if (destenation == "miami")
  24.                 {
  25.                     sumAdults = (sumAdults + 24.99) * nights * 2;
  26.                     sumChildren = (sumChildren + 14.99) * nights * 3;
  27.                 }
  28.                 if (destenation == "canary islands")
  29.                 {
  30.                     sumAdults = (sumAdults + 32.50) * nights * 2;
  31.                     sumChildren = (sumChildren + 28.50) * nights * 3;
  32.                 }
  33.                 if (destenation == "philippines")
  34.                 {
  35.                     sumAdults =  42.99 * nights * 2;
  36.                     sumChildren =  39.99 * nights * 3;
  37.                 }
  38.             }
  39.             else if (nights <= 15)
  40.             {
  41.                 if (destenation == "miami")
  42.                 {
  43.                     sumAdults =  + 22.99 * nights * 2;
  44.                     sumChildren =  + 11.99 * nights * 3;
  45.                 }
  46.                 if (destenation == "canary islands")
  47.                 {
  48.                     sumAdults = (sumAdults + 30.50) * nights * 2;
  49.                     sumChildren = (sumChildren + 25.60) * nights * 3;
  50.                 }
  51.                  if (destenation == "philippines")
  52.                 {
  53.                     sumAdults = (sumAdults + 41) * nights * 2;
  54.                     sumChildren = (sumChildren + 36) * nights * 3;
  55.                 }
  56.             }
  57.             else if (nights > 15)
  58.             {
  59.                 if (destenation == "miami")
  60.                 {
  61.                     sumAdults = (sumAdults + 20) * nights * 2;
  62.                     sumChildren = (sumChildren + 10) * nights * 3;
  63.                 }
  64.                  if (destenation == "canary islands")
  65.                 {
  66.                     sumAdults = (sumAdults + 28) * nights * 2;
  67.                     sumChildren = (sumChildren + 22) * nights * 3;
  68.                 }
  69.                  if (destenation == "philippines")
  70.                 {
  71.                     sumAdults = (sumAdults + 38.50) * nights * 2;
  72.                     sumChildren = (sumChildren + 32.40) * nights * 3;
  73.                 }
  74.             }
  75.  
  76.             sumdestanation = (sumAdults + sumChildren) * 1.25; //  25% dog expen
  77.  
  78.             if (transport == "train")
  79.             {
  80.                 sumTickets = (2 * 22.30) + (3 * 12.50); //  2 adult, 3 children
  81.             }
  82.             if (transport == "bus")
  83.             {
  84.                 sumTickets = (2 * 45) + (3 * 37);
  85.             }
  86.             if (transport == "airplane")
  87.             {
  88.                 sumTickets = (2 * 90) + (3 * 68.50);
  89.             }
  90.  
  91.             sumTotal = sumdestanation + sumTickets;
  92.  
  93.             Console.WriteLine($"{sumTotal:f3}");
  94.         }
  95.     }
  96. }
Advertisement
Add Comment
Please, Sign In to add comment