Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace ТО9
- {
- internal class Program
- {
- static void Main()
- {
- // Read input
- int daysToStay = int.Parse(Console.ReadLine());
- string roomType = Console.ReadLine();
- string assessment = Console.ReadLine();
- // Define room prices
- double roomForOnePersonPrice = 118.00;
- double apartmentPrice = 155.00;
- double presidentApartmentPrice = 235.00;
- // Calculate the number of nights (for discounts)
- int nights = daysToStay - 1;
- // Calculate the initial cost based on room type and nights
- double initialCost = 0.0;
- switch (roomType)
- {
- case "room for one person":
- initialCost = roomForOnePersonPrice * nights;
- break;
- case "apartment":
- initialCost = apartmentPrice * nights;
- if (nights < 10)
- {
- initialCost *= 0.70; // 30% discount
- }
- else if (nights <= 15)
- {
- initialCost *= 0.65; // 35% discount
- }
- else
- {
- initialCost *= 0.50; // 50% discount
- }
- break;
- case "president apartment":
- initialCost = presidentApartmentPrice * nights;
- if (nights < 10)
- {
- initialCost *= 0.90; // 10% discount
- }
- else if (nights <= 15)
- {
- initialCost *= 0.85; // 15% discount
- }
- else
- {
- initialCost *= 0.80; // 20% discount
- }
- break;
- }
- // Calculate the final cost based on assessment
- if (assessment == "positive")
- {
- initialCost *= 1.25; // 25% positive assessment bonus
- }
- else if (assessment == "negative")
- {
- initialCost *= 0.90; // 10% negative assessment deduction
- }
- double finalCost = Math.Round(initialCost, 2);
- // Print the final cost
- Console.WriteLine(finalCost);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement