Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq.Expressions;
- namespace gf
- {
- class Program
- {
- static void Main(string[] args)
- {
- //Първи ред -дни за престой -цяло число в интервала[0...365]
- // Втори ред -вид помещение - " room for one person", " apartment & quot; или & quot; president apartment"
- // Трети ред -оценка - " positive & quot; или & quot; negative & quot;
- double day = double.Parse(Console.ReadLine());
- string type = Console.ReadLine();
- string evaluation = Console.ReadLine();
- double pricePerNight = 0;
- double discount = 0;
- if (type == "room for one person")
- {
- pricePerNight = 18;
- }
- else if (type =="apartment")
- {
- pricePerNight = 25;
- if (day<10)
- {
- discount = 0.30;
- }
- else if (day >10 && day <15)
- {
- discount = 0.35;
- }
- else if (day >15)
- {
- discount = 0.50;
- }
- }
- else if (type == "president apartment")
- {
- pricePerNight = 35;
- if (day < 10)
- {
- discount = 0.10;
- }
- else if (day > 10 && day < 15)
- {
- discount = 0.15;
- }
- else if (day > 15)
- {
- discount = 0.20;
- }
- }
- double totalPrice = pricePerNight * (day - 1);
- totalPrice -= totalPrice * discount;
- if (evaluation =="positive")
- {
- totalPrice += totalPrice * 0.25;
- }
- else if (evaluation=="negative")
- {
- totalPrice -= totalPrice * 0.10;
- }
- Console.WriteLine($"{totalPrice:f2}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment