Advertisement
marangoni

Cruise Ship

Jul 27th, 2019
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.27 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ConsoleApp1
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.  
  10.             string tipeCruis = Console.ReadLine();
  11.             string tipeRoom = Console.ReadLine();
  12.             int countNights = int.Parse(Console.ReadLine());
  13.  
  14.  
  15.             double price = 0;
  16.             double totalPrice = 0;
  17.             switch (tipeCruis)
  18.             {
  19.                 case "Mediterranean":
  20.                     if (tipeRoom == "standard cabin")
  21.                     {
  22.                         price = 27.5;
  23.                     }
  24.                     else if (tipeRoom == "cabin with balcony")
  25.                     {
  26.                         price = 30.2;
  27.                     }
  28.                     else if (tipeRoom == "apartament")
  29.                     {
  30.                         price = 40.5;
  31.                     }
  32.                     break;
  33.                 case "Adriatic":
  34.                     if (tipeRoom == "standard cabin")
  35.                     {
  36.                         price = 22.99;
  37.                     }
  38.                     else if (tipeRoom == "cabin with balcony")
  39.                     {
  40.                         price = 25;
  41.                     }
  42.                     else if (tipeRoom == "apartament")
  43.                     {
  44.                         price = 34.99;
  45.                     }
  46.                     break;
  47.                 case "Aegean":
  48.                     if (tipeRoom == "standard cabin")
  49.                     {
  50.                         price = 23;
  51.                     }
  52.                     else if (tipeRoom == "cabin with balcony")
  53.                     {
  54.                         price = 26.6;
  55.                     }
  56.                     else if (tipeRoom == "apartament")
  57.                     {
  58.                         price = 39.8;
  59.                     }
  60.                     break;
  61.                 default:
  62.                     break;
  63.             }
  64.  
  65.             if (countNights > 7)
  66.             {
  67.                 totalPrice = (countNights * price * 4) * 0.75;
  68.                
  69.             }
  70.             else
  71.             {
  72.                 totalPrice = countNights * price * 4;
  73.             }
  74.  
  75.             Console.WriteLine($"Annie's holiday in the {tipeCruis} sea costs {totalPrice:F2} lv.");
  76.  
  77.         }
  78.     }
  79. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement