Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Text;
- namespace P04HotelReservation
- {
- public class PriceCalculator
- {
- public static decimal CalculatePrice(decimal pricePerDay, int numberOfDays, Season season, Discount discount = 0)
- {
- int multiplier = (int)season;
- decimal discountMultiplier = (decimal)discount / 100;
- decimal priceBeforeDiscount = numberOfDays * pricePerDay * multiplier;
- decimal discountedAmount =
- priceBeforeDiscount * discountMultiplier;
- decimal finalPrice = priceBeforeDiscount - discountedAmount;
- return finalPrice;
- }
- }
- public enum Season
- {
- Spring = 2,
- Summer = 4,
- Autumn = 1,
- Winter = 3
- }
- public enum Discount
- {
- None,
- SecondVisit = 10,
- VIP = 20
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement