static void Main(string[] args) { string[] tokens = Console.ReadLine().Split(' ', StringSplitOptions.RemoveEmptyEntries); decimal price = decimal.Parse(tokens[0]); int days = int.Parse(tokens[1]); Season season = Enum.Parse <Season>(tokens[2]); Discount discount = Discount.None; if (tokens.Length == 4) { discount = Enum.Parse <Discount>(tokens[3]); } decimal totalPrice = PriceCalculator.GetTotalPrice(price, days, season, discount); Console.WriteLine($"{totalPrice:F2}"); }
public static void Main() { var data = Console.ReadLine().Split(); var pricePerDay = decimal.Parse(data[0]); var numberOfDays = int.Parse(data[1]); var season = data[2]; var discountType = "None"; if (data.Length > 3) { discountType = data[3]; } var totalPrice = PriceCalculator.GetTotalPrice(pricePerDay, numberOfDays, Enum.Parse <Season>(season), Enum.Parse <Discount>(discountType)); Console.WriteLine($"{totalPrice:f2}"); }