Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace HotelsRoom
- {
- class Program
- {
- static void Main(string[] args)
- {
- //Programming Basics Exam - 28 August 2016 - HotelsRoom
- string month = Console.ReadLine().ToLower();
- int days = int.Parse(Console.ReadLine());
- double studioPrice = days;
- double apartmentPrice = days;
- double discount = 0.0f;
- var isMayOctober = month == "may" || month == "octŠ¾ber";
- var isJuneSeptember = month == "june" || month == "september";
- var isJulyAugust = month == "july" || month == "august";
- if (isMayOctober)
- {
- studioPrice *= 50.00f;
- apartmentPrice *= 65.00f;
- }
- else if (isJuneSeptember)
- {
- studioPrice *= 75.20f;
- apartmentPrice *= 68.70f;
- }
- else if (isJulyAugust)
- {
- studioPrice *= 76.0f;
- apartmentPrice *= 77.00f;
- }
- if (days > 14 && isMayOctober)
- {
- discount = 0.30*studioPrice;
- studioPrice = studioPrice - discount;
- }
- else if (days>7 && isMayOctober)
- {
- discount = 0.05*studioPrice;
- studioPrice = studioPrice-discount;
- }
- else if (days > 14 && isJuneSeptember)
- {
- discount = 0.20*studioPrice;
- studioPrice = studioPrice - discount;
- }
- if (days > 14 )
- {
- discount = 0.10*apartmentPrice;
- apartmentPrice = apartmentPrice - discount;
- }
- Console.WriteLine($"Apartment: {apartmentPrice:f2} lv.");
- Console.WriteLine($"Studio: {studioPrice:f2} lv.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement