Advertisement
Guest User

Untitled

a guest
Aug 28th, 2016
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.03 KB | None | 0 0
  1. namespace Axe
  2. {
  3.     using System;
  4.     class Program
  5.     {
  6.         static void Main(string[] args)
  7.         {
  8.             var studioPrice = new decimal[] { 50, 75.20m, 76 };
  9.             var apartmentPrice = new decimal[] { 65, 68.70m, 77 };
  10.  
  11.             var month = Console.ReadLine();
  12.             var nights = int.Parse(Console.ReadLine());
  13.             int index = month == "June" || month == "September" ? 1 :
  14.                        (month == "July" || month == "August" ? 2 : 0);
  15.             var studioDiscount = nights > 7 && index == 0 ? 0.95m : 1m;
  16.             var apartmentDiscount = nights > 14 ? 0.9m : 1m;
  17.             if (nights > 14 && index != 2) studioDiscount = index == 0 ? 0.70m : 0.80m;
  18.        
  19.             apartmentPrice[index] = apartmentPrice[index] * apartmentDiscount;
  20.             studioPrice[index] = studioPrice[index] * studioDiscount;
  21.             Console.WriteLine("Apartment: {0:f2} lv.\nStudio: {1:f2} lv.",
  22.                 nights * apartmentPrice[index], nights * studioPrice[index]);
  23.         }
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement