Advertisement
Guest User

Untitled

a guest
Jul 5th, 2019
539
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.76 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _04_Hotel_Reservation
  4. {
  5.     class Program
  6.     {
  7.         static void Main()
  8.         {
  9.             string[] input = Console.ReadLine().Split(' ', StringSplitOptions.RemoveEmptyEntries);
  10.  
  11.             decimal pricePerDay = decimal.Parse(input[0]);
  12.             int numberOfDays = int.Parse(input[1]);
  13.             string season = input[2].ToLower();
  14.             string discountType = "none";
  15.  
  16.             if (input.Length > 3) discountType = input[3].ToLower();
  17.  
  18.             decimal totalPrice = PriceCalculator.CalculatePrice(pricePerDay,
  19.                 numberOfDays,
  20.                 Enum.Parse<Season>(season),
  21.                 Enum.Parse<Discount>(discountType));
  22.  
  23.             Console.WriteLine($"{totalPrice:f2}");
  24.         }
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement