Yachkov

Untitled

Jan 28th, 2021
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.02 KB | None | 0 0
  1. using System;
  2. using System.ComponentModel;
  3. using System.ComponentModel.DataAnnotations;
  4. using System.ComponentModel.Design;
  5. using System.Globalization;
  6. using System.Reflection;
  7. using System.Runtime.ConstrainedExecution;
  8. using System.Security.Cryptography;
  9.  
  10. namespace SomeExcercises
  11. {
  12.     class Program
  13.     {
  14.         static void Main(string[] args)
  15.         {
  16.             double priceForStudio = 0;
  17.             double priceForApartment = 0;
  18.             string month = Console.ReadLine();
  19.             int sleeps = int.Parse(Console.ReadLine());
  20.  
  21.  
  22.             switch (month)
  23.             {
  24.                 case "May":
  25.                 case "October":
  26.                     priceForStudio = sleeps * 50;
  27.                     priceForApartment = sleeps * 65;
  28.                     if (sleeps > 7 && sleeps <= 14)
  29.                     {
  30.                         priceForStudio -= priceForStudio * 0.05;
  31.                     }
  32.                     else if (sleeps > 14)
  33.                     {
  34.                         priceForStudio -= priceForStudio * 0.30;
  35.                         priceForApartment -= priceForApartment * 0.10;
  36.                     }
  37.                     break;
  38.                 case "June":
  39.                 case "September":
  40.                     priceForStudio = sleeps * 75.20;
  41.                     priceForApartment = sleeps * 68.70;
  42.                     if (sleeps > 14)
  43.                     {
  44.                         priceForStudio -= priceForStudio * 0.20;
  45.                         priceForApartment -= priceForApartment * 0.10;
  46.                     }
  47.                     break;
  48.                 case "July":
  49.                 case "August":
  50.                     priceForStudio = sleeps * 76;
  51.                     priceForApartment = sleeps * 77;
  52.                     priceForApartment -= priceForApartment * 0.10;
  53.                     break;
  54.  
  55.             }
  56.             Console.WriteLine($"Apartment: {priceForApartment:f2} lv.");
  57.             Console.WriteLine($"Studio: {priceForStudio:f2} lv.");
  58.         }
  59.     }
  60. }
  61.  
  62.  
  63.  
  64.  
Advertisement
Add Comment
Please, Sign In to add comment