Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConditionsExercise
- {
- class Program
- {
- static void Main(string[] args)
- {
- string month = Console.ReadLine();
- int nights = int.Parse(Console.ReadLine());
- string typeOfAccommodation = "";
- double priceForStudio = 0.0;
- double priceForApartment = 0.0;
- switch (month)
- {
- case "May":
- case "October":
- if (typeOfAccommodation == "Studio")
- {
- if (nights > 7 && nights <= 14)
- {
- priceForStudio = (nights * 50) * 0.95;
- }
- else if (nights > 14)
- {
- priceForStudio = (nights * 50) * 0.7;
- }
- else
- {
- priceForStudio = nights * 50;
- }
- }
- else if (typeOfAccommodation == "Apartment")
- {
- if (nights > 14)
- {
- priceForApartment = (nights * 65) * 0.9;
- }
- else
- {
- priceForApartment = nights * 65;
- }
- }
- break;
- case "June":
- case "September":
- if (typeOfAccommodation == "Studio")
- {
- if (nights > 14)
- {
- priceForStudio = (nights * 75.20) * 0.8;
- }
- else
- {
- priceForStudio = nights * 75.20;
- }
- }
- else if (typeOfAccommodation == "Apartment")
- {
- if (nights > 14)
- {
- priceForApartment = (nights * 68.70) * 0.9;
- }
- else
- {
- priceForApartment = nights * 68.70;
- }
- }
- break;
- case "July":
- case "August":
- if (typeOfAccommodation == "Studio")
- {
- priceForStudio = nights * 76;
- }
- else if (typeOfAccommodation == "Apartment")
- {
- if (nights > 14)
- {
- priceForApartment = (nights * 77) * 0.9;
- }
- else
- {
- priceForApartment = nights * 77;
- }
- }
- break;
- }
- Console.WriteLine($"Apartment: {priceForStudio:f2} lv.");
- Console.WriteLine($"Apartment: {priceForApartment:f2} lv.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment