desislava_topuzakova

03. Cruise Ship

May 1st, 2020
307
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.38 KB | None | 0 0
  1. using System;
  2. using System.Diagnostics;
  3.  
  4. namespace demo
  5. {
  6.     class Program
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.  
  11.             //сума за почивка = 4 (бр. хора) * брой нощувки * цена за 1 нощувка
  12.             string cruiseType = Console.ReadLine(); // "Mediterranean", "Adriatic", "Aegean"
  13.             string roomType = Console.ReadLine(); // "standard cabin", "cabin with balcony", "apartment"
  14.             int countNights = int.Parse(Console.ReadLine());
  15.  
  16.             double price = 0;
  17.  
  18.             switch (cruiseType)
  19.             {
  20.                 case "Mediterranean":
  21.                     if (roomType == "standard cabin")
  22.                     {
  23.                         price = 27.50;
  24.                     }
  25.                     else if (roomType == "cabin with balcony")
  26.                     {
  27.                         price = 30.20;
  28.                     }
  29.                     else if (roomType == "apartment")
  30.                     {
  31.                         price = 40.50;
  32.                     }
  33.                     break;
  34.                 case "Adriatic":
  35.                     if (roomType == "standard cabin")
  36.                     {
  37.                         price = 22.99;
  38.                     }
  39.                     else if (roomType == "cabin with balcony")
  40.                     {
  41.                         price = 25.00;
  42.                     }
  43.                     else if (roomType == "apartment")
  44.                     {
  45.                         price = 34.99;
  46.                     }
  47.                     break;
  48.                 case "Aegean":
  49.                     if (roomType == "standard cabin")
  50.                     {
  51.                         price = 23.00;
  52.                     }
  53.                     else if (roomType == "cabin with balcony")
  54.                     {
  55.                         price = 26.60;
  56.                     }
  57.                     else if (roomType == "apartment")
  58.                     {
  59.                         price = 39.80;
  60.                     }
  61.                     break;
  62.             }
  63.  
  64.             double totalSum = 4 * countNights * price;
  65.  
  66.             if (countNights > 7)
  67.             {
  68.                 totalSum = totalSum - 0.25 * totalSum; //0.75 * totalSum;
  69.             }
  70.  
  71.             Console.WriteLine($"Annie's holiday in the {cruiseType} sea costs {totalSum:F2} lv.");
  72.  
  73.  
  74.         }
  75.     }
  76. }
Add Comment
Please, Sign In to add comment