Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Dynamic;
- using System.Globalization;
- namespace SoftUniExercises
- {
- class Program
- {
- static void Main(string[] args)
- {
- int days = int.Parse(Console.ReadLine()) - 1;
- string type = Console.ReadLine();
- string grade = Console.ReadLine();
- double cost;
- double discount;
- double addOrSub;
- switch (type)
- {
- case "room for one person":
- cost = days * 18.00;
- if (grade == "positive")
- {
- addOrSub = cost * 0.25;
- Console.WriteLine("{0:F2}", cost + addOrSub);
- }
- else
- {
- addOrSub = cost * 0.1;
- Console.WriteLine("{0:F2}", cost - addOrSub);
- }
- break;
- case "apartment":
- cost = days * 25.00;
- if (days < 10)
- {
- discount = cost * 0.30;
- cost -= discount;
- if (grade == "positive")
- {
- addOrSub = cost * 0.25;
- Console.WriteLine("{0:F2}", cost + addOrSub);
- }
- else
- {
- addOrSub = cost * 0.1;
- Console.WriteLine("{0:F2}", cost - addOrSub);
- }
- }
- else if (days >= 10 && days <= 15)
- {
- discount = cost * 0.35;
- cost -= discount;
- if (grade == "positive")
- {
- addOrSub = cost * 0.25;
- Console.WriteLine("{0:F2}", cost + addOrSub);
- }
- else
- {
- addOrSub = cost * 0.1;
- Console.WriteLine("{0:F2}", cost - addOrSub);
- }
- }
- else
- {
- discount = cost * 0.50;
- cost -= discount;
- if (grade == "positive")
- {
- addOrSub = cost * 0.25;
- Console.WriteLine("{0:F2}", cost + addOrSub);
- }
- else
- {
- addOrSub = cost * 0.1;
- Console.WriteLine("{0:F2}", cost - addOrSub);
- }
- }
- break;
- case "president apartment":
- cost = days * 35.00;
- if (days < 10)
- {
- discount = cost * 0.10;
- cost -= discount;
- if (grade == "positive")
- {
- addOrSub = cost * 0.25;
- Console.WriteLine("{0:F2}", cost + addOrSub);
- }
- else
- {
- addOrSub = cost * 0.1;
- Console.WriteLine("{0:F2}", cost - addOrSub);
- }
- }
- else if (days >= 10 && days <= 15)
- {
- discount = cost * 0.15;
- cost -= discount;
- if (grade == "positive")
- {
- addOrSub = cost * 0.25;
- Console.WriteLine("{0:F2}", cost + addOrSub);
- }
- else
- {
- addOrSub = cost * 0.1;
- Console.WriteLine("{0:F2}", cost - addOrSub);
- }
- }
- else
- {
- discount = cost * 0.20;
- cost -= discount;
- if (grade == "positive")
- {
- addOrSub = cost * 0.25;
- Console.WriteLine("{0:F2}", cost + addOrSub);
- }
- else
- {
- addOrSub = cost * 0.1;
- Console.WriteLine("{0:F2}", cost - addOrSub);
- }
- }
- break;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement