Advertisement
Filkolev

SkiTrip

Feb 4th, 2019
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 4.81 KB | None | 0 0
  1. using System;
  2.  
  3. class Program
  4. {
  5.     static void Main(string[] args)
  6.     {
  7.         int daysToStay = int.Parse(Console.ReadLine());
  8.         string roomType = Console.ReadLine().ToLower();
  9.         string feedBack = Console.ReadLine().ToLower();
  10.  
  11.         double positiveFeedBackPercentageToAdd = 25;
  12.         double negativeFeedBackPercentageDiscount = 10;
  13.         double nightsToPay = daysToStay - 1;
  14.         double discountForNight = 0;
  15.  
  16.         double onePersonRoomPrice = 18;
  17.         double apartmentPrice = 25.00;
  18.         double presidentApartmentPrice = 35.00;
  19.  
  20.         double totalCost = 0;
  21.  
  22.         switch (roomType)
  23.         {
  24.             case "room for one person":
  25.                 {
  26.                     if (feedBack == "positive")
  27.                     {
  28.  
  29.                         totalCost = nightsToPay * onePersonRoomPrice * (1 + (1.00*positiveFeedBackPercentageToAdd/100));
  30.                         Console.WriteLine($"{totalCost:F2}");
  31.                     }
  32.                     else
  33.                     {
  34.                         totalCost = nightsToPay * onePersonRoomPrice * (1.00 - (1.00 * negativeFeedBackPercentageDiscount / 100));
  35.                         Console.WriteLine($"{totalCost:F2}");
  36.                     }
  37.                 }
  38.                 break;
  39.             case "apartment":
  40.                 {
  41.                     switch (feedBack)
  42.                     {
  43.                         case "positive":
  44.                             if (daysToStay >= 0 && daysToStay < 10)
  45.                             {
  46.                                 discountForNight = 30;
  47.                                 totalCost = (nightsToPay * apartmentPrice * (1.00 - (1.00 * discountForNight / 100))) * (1 + (1.00*positiveFeedBackPercentageToAdd/100));
  48.                                 Console.WriteLine($"{totalCost:F2}");
  49.                             }
  50.                             else if (daysToStay >= 10 && daysToStay <= 15)
  51.                             {
  52.                                 discountForNight = 35;
  53.                                 totalCost = (nightsToPay * apartmentPrice * (1.00 - (1.00 * discountForNight / 100))) * (1 + (1.00 * positiveFeedBackPercentageToAdd / 100));
  54.                                 Console.WriteLine($"{totalCost:F2}");
  55.                             }
  56.                             else if (daysToStay > 15)
  57.                             {
  58.                                 discountForNight = 50;
  59.                                 totalCost = (nightsToPay * apartmentPrice * (1.00 - (1.00 * discountForNight / 100))) * (1 + (1.00 * positiveFeedBackPercentageToAdd / 100));
  60.                                 Console.WriteLine($"{totalCost:F2}");
  61.                             }
  62.                             break;
  63.                         case "negative":
  64.                             if (daysToStay >= 0 && daysToStay < 10)
  65.                             {
  66.                                 discountForNight = 30;
  67.                                 totalCost = (nightsToPay * apartmentPrice * (1.00 - (1.00 * discountForNight / 100))) * (1-(1.00 * negativeFeedBackPercentageDiscount / 100));
  68.                                 Console.WriteLine($"{totalCost:F2}");
  69.                             }
  70.                             else if (daysToStay >= 10 && daysToStay <= 15)
  71.                             {
  72.                                 discountForNight = 35;
  73.                                 totalCost = (nightsToPay * apartmentPrice * (1.00 - (1.00 * discountForNight / 100))) * (1 - (1.00 * negativeFeedBackPercentageDiscount / 100));
  74.                                 Console.WriteLine($"{totalCost:F2}");
  75.                             }
  76.                             else if (daysToStay > 15)
  77.                             {
  78.                                 discountForNight = 50;
  79.                                 totalCost = (nightsToPay * apartmentPrice * (1.00 - (1.00 * discountForNight / 100))) * (1 - (1.00 * negativeFeedBackPercentageDiscount / 100));
  80.                                 Console.WriteLine($"{totalCost:F2}");
  81.                             }
  82.                             break;
  83.                     }
  84.  
  85.                 }
  86.                 break;
  87.             case "president apartment":
  88.                 switch (feedBack)
  89.                 {
  90.                     case "positive":
  91.                         if (daysToStay >= 0 && daysToStay < 10)
  92.                         {
  93.                             discountForNight = 30;
  94.                             totalCost = (nightsToPay * presidentApartmentPrice * (1.00 - (1.00 * discountForNight / 100))) * (1 + (1.00 * positiveFeedBackPercentageToAdd / 100));
  95.                             Console.WriteLine($"{totalCost:F2}");
  96.                         }
  97.                         else if (daysToStay >= 10 && daysToStay <= 15)
  98.                         {
  99.                             discountForNight = 35;
  100.                             totalCost = (nightsToPay * presidentApartmentPrice * (1.00 - (1.00 * discountForNight / 100))) * (1 + (1.00 * positiveFeedBackPercentageToAdd / 100));
  101.                             Console.WriteLine($"{totalCost:F2}");
  102.                         }
  103.                         else if (daysToStay > 15)
  104.                         {
  105.                             discountForNight = 50;
  106.                             totalCost = (nightsToPay * presidentApartmentPrice * (1.00 - (1.00 * discountForNight / 100))) * (1 + (1.00 * positiveFeedBackPercentageToAdd / 100));
  107.                             Console.WriteLine($"{totalCost:F2}");
  108.                         }
  109.                         break;
  110.                     case "negative":
  111.                         if (daysToStay >= 0 && daysToStay < 10)
  112.                         {
  113.                             discountForNight = 10;
  114.                             totalCost = (nightsToPay * presidentApartmentPrice * (1.00 - (1.00 * discountForNight / 100))) * (1 - (1.00 * negativeFeedBackPercentageDiscount / 100));
  115.                             Console.WriteLine($"{totalCost:F2}");
  116.                         }
  117.                         else if (daysToStay >= 10 && daysToStay <= 15)
  118.                         {
  119.                             discountForNight = 15;
  120.                             totalCost = (nightsToPay * presidentApartmentPrice * (1.00 - (1.00 * discountForNight / 100))) * (1 - (1.00 * negativeFeedBackPercentageDiscount / 100));
  121.                             Console.WriteLine($"{totalCost:F2}");
  122.                         }
  123.                         else if (daysToStay > 15)
  124.                         {
  125.                             discountForNight = 20;
  126.                             totalCost = (nightsToPay * presidentApartmentPrice * (1.00 - (1.00 * discountForNight / 100))) * (1 - (1.00 * negativeFeedBackPercentageDiscount / 100));
  127.                             Console.WriteLine($"{totalCost:F2}");
  128.                         }
  129.                         break;
  130.  
  131.                 }
  132.                 break;
  133.         }
  134.     }
  135. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement