Advertisement
silvana1303

cruise ship

May 2nd, 2020
711
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.77 KB | None | 0 0
  1. using System;
  2.  
  3. namespace exampreparation
  4. {
  5.     class exam
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             string cruise = Console.ReadLine();
  10.             string cabin = Console.ReadLine();
  11.             int overnight = int.Parse(Console.ReadLine());
  12.             double price = 0.0;
  13.  
  14.             if (cruise == "Mediterranean")
  15.             {
  16.                 if (cabin == "standard cabin")
  17.                 {
  18.                     price = 27.50;
  19.                 }
  20.                 else if (cabin == "cabin with balcony")
  21.                 {
  22.                     price = 30.20;
  23.                 }
  24.                 else
  25.                 {
  26.                     price = 40.50;
  27.                 }
  28.             }
  29.             else if (cruise == "Adriatic")
  30.             {
  31.                 if (cabin == "standard cabin")
  32.                 {
  33.                     price = 22.99;
  34.                 }
  35.                 else if (cabin == "cabin with balcony")
  36.                 {
  37.                     price = 25.00;
  38.                 }
  39.                 else
  40.                 {
  41.                     price = 34.99;
  42.                 }
  43.             }
  44.             else
  45.             {
  46.                 if (cabin == "standard cabin")
  47.                 {
  48.                     price = 23.00;
  49.                 }
  50.                 else if (cabin == "cabin with balcony")
  51.                 {
  52.                     price = 26.60;
  53.                 }
  54.                 else
  55.                 {
  56.                     price = 39.80;
  57.                 }
  58.             }
  59.  
  60.             double sum = price * 4 * overnight;
  61.  
  62.             if (overnight > 7)
  63.             {
  64.                 sum *= 0.75;
  65.             }
  66.  
  67.             Console.WriteLine($"Annie's holiday in the {cruise} sea costs {sum:F2} lv.");
  68.         }
  69.     }
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement