Advertisement
Guest User

Hotel Room

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