Advertisement
KeepCoding

Ivanovi's Holiday

Jan 20th, 2018
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.58 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 T3IvanovisHoliday
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int nightsToStay = int.Parse(Console.ReadLine());
  14.             string destination = Console.ReadLine().ToLower();
  15.             string transport = Console.ReadLine().ToLower();
  16.  
  17.             double stayPriceAdults = 0;
  18.             double stayPriceKids = 0;
  19.  
  20.             switch (destination)
  21.             {
  22.                 case "miami":
  23.                     if (nightsToStay >= 1 && nightsToStay <= 10)
  24.                     {
  25.                         stayPriceAdults = 24.99;
  26.                         stayPriceKids = 14.99;
  27.                     } else if (nightsToStay >= 11 && nightsToStay <= 15)
  28.                     {
  29.                         stayPriceAdults = 22.99;
  30.                         stayPriceKids = 11.99;
  31.                     } else if (nightsToStay > 15)
  32.                     {
  33.                         stayPriceAdults = 20.0;
  34.                         stayPriceKids = 10.0;
  35.                     }
  36.  
  37.                     break;
  38.  
  39.                 case "canary islands":
  40.                     if (nightsToStay >= 1 && nightsToStay <= 10)
  41.                     {
  42.                         stayPriceAdults = 32.5;
  43.                         stayPriceKids = 28.5;
  44.                     }
  45.                     else if (nightsToStay >= 11 && nightsToStay <= 15)
  46.                     {
  47.                         stayPriceAdults = 30.5;
  48.                         stayPriceKids = 25.6;
  49.                     }
  50.                     else if (nightsToStay > 15)
  51.                     {
  52.                         stayPriceAdults = 28.0;
  53.                         stayPriceKids = 22.0;
  54.                     }
  55.  
  56.                     break;
  57.  
  58.                 case "philippines":
  59.                     if (nightsToStay >= 1 && nightsToStay <= 10)
  60.                     {
  61.                         stayPriceAdults = 42.99;
  62.                         stayPriceKids = 39.99;
  63.                     }
  64.                     else if (nightsToStay >= 11 && nightsToStay <= 15)
  65.                     {
  66.                         stayPriceAdults = 41.0;
  67.                         stayPriceKids = 36.0;
  68.                     }
  69.                     else if (nightsToStay > 15)
  70.                     {
  71.                         stayPriceAdults = 38.5;
  72.                         stayPriceKids = 32.4;
  73.                     }
  74.  
  75.                     break;
  76.             }
  77.  
  78.             double totalPriceForStay = nightsToStay * (2 * stayPriceAdults + 3 * stayPriceKids);
  79.             totalPriceForStay += totalPriceForStay * 0.25; //0.25 za kucheto
  80.  
  81.             double transportPriceAdults = 0;
  82.             double transportPriceKids = 0;
  83.  
  84.             switch (transport)
  85.             {
  86.                 case "train":
  87.                     transportPriceAdults = 22.3;
  88.                     transportPriceKids = 12.5;
  89.                     break;
  90.                 case "bus":
  91.                     transportPriceAdults = 45.0;
  92.                     transportPriceKids = 37.0;
  93.                     break;
  94.                 case "airplane":
  95.                     transportPriceAdults = 90.0;
  96.                     transportPriceKids = 68.5;
  97.                     break;
  98.             }
  99.  
  100.             double totalPriceForTransport = 2 * transportPriceAdults + 3 * transportPriceKids;
  101.             double totalPrice = totalPriceForStay + totalPriceForTransport;
  102.  
  103.             Console.WriteLine($"{totalPrice:F3}");
  104.  
  105.  
  106.             //main ends here
  107.         }
  108.     }
  109. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement