Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace Axe
- {
- using System;
- class Program
- {
- static void Main(string[] args)
- {
- var studioPrice = new decimal[] { 50, 75.20m, 76 };
- var apartmentPrice = new decimal[] { 65, 68.70m, 77 };
- var month = Console.ReadLine();
- var nights = int.Parse(Console.ReadLine());
- int index = month == "June" || month == "September" ? 1 :
- (month == "July" || month == "August" ? 2 : 0);
- var studioDiscount = nights > 7 && index == 0 ? 0.95m : 1m;
- var apartmentDiscount = nights > 14 ? 0.9m : 1m;
- if (nights > 14 && index != 2) studioDiscount = index == 0 ? 0.70m : 0.80m;
- apartmentPrice[index] = apartmentPrice[index] * apartmentDiscount;
- studioPrice[index] = studioPrice[index] * studioDiscount;
- Console.WriteLine("Apartment: {0:f2} lv.\nStudio: {1:f2} lv.",
- nights * apartmentPrice[index], nights * studioPrice[index]);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement