Advertisement
Guest User

Untitled

a guest
May 4th, 2023
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.04 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Hotel_Room
  4. {
  5.     internal class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             string month = Console.ReadLine();
  10.             int accomodation = int.Parse(Console.ReadLine());
  11.             decimal totalStudio = 0;
  12.             decimal totalApartment = 0;
  13.             decimal discountStudio = 0;
  14.             decimal discountApartment = 0.10m;
  15.  
  16.  
  17.             if (month == "May" || month == "October")
  18.             {
  19.                 decimal studio = 50;
  20.                 decimal apartment = 65;
  21.                 totalStudio = studio * accomodation;
  22.                 totalApartment = apartment * accomodation;
  23.  
  24.                 if (accomodation > 7 && accomodation <= 14)
  25.                 {
  26.                     discountStudio = 0.05m;
  27.                     discountStudio = studio * discountStudio;
  28.                     totalStudio = (studio - discountStudio) * accomodation;
  29.                     totalApartment = apartment * accomodation;
  30.                 }
  31.                 if (accomodation > 14)
  32.                 {
  33.                     discountStudio = 0.30m;
  34.                     discountStudio = studio * discountStudio;
  35.                     totalStudio = (studio - discountStudio) * accomodation;
  36.                     discountApartment = apartment * discountApartment;
  37.                     totalApartment = (apartment - discountApartment) * accomodation;
  38.                 }
  39.             }
  40.             if (month == "June" || month == "September")
  41.             {
  42.                 decimal studio = 75.20m;
  43.                 decimal apartment = 68.70m;
  44.                 totalStudio = studio * accomodation;
  45.                 totalApartment = apartment * accomodation;
  46.  
  47.                 if (accomodation > 14)
  48.                 {
  49.                     discountStudio = 0.20m;
  50.                     discountStudio = studio * discountStudio;
  51.                     totalStudio = (studio - discountStudio) * accomodation;
  52.                     discountApartment = apartment * discountApartment;
  53.                     totalApartment = (apartment - discountApartment) * accomodation;
  54.                 }
  55.             }
  56.             if (month == "July" || month == "August")
  57.             {
  58.                 decimal studio = 76;
  59.                 decimal apartment = 77;
  60.                 totalStudio = studio * accomodation;
  61.                 totalApartment = apartment * accomodation;
  62.                 if (accomodation > 7)
  63.                 {
  64.                     totalApartment = apartment * accomodation;
  65.                     totalStudio = studio * accomodation;
  66.                 }
  67.                 if (accomodation > 14)
  68.                 {
  69.                     totalStudio = studio * accomodation;
  70.  
  71.                     discountApartment = apartment * discountApartment;
  72.                     totalApartment = (apartment - discountApartment) * accomodation;
  73.                 }
  74.             }
  75.  
  76.  
  77.             Console.WriteLine($"Apartment: {totalApartment:f2} lv.");
  78.             Console.WriteLine($"Studio: {totalStudio:f2} lv.");
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.         }
  89.     }
  90. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement