Advertisement
Guest User

Untitled

a guest
Jul 5th, 2019
437
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.66 KB | None | 0 0
  1. public static class PriceCalculator
  2. {
  3.     public static decimal CalculatePrice(decimal pricePerDay, int numberOfDays, Season season, Discount discountType)
  4.     {
  5.         int priceMultiplier = (int)season;
  6.         decimal discountMultiplier = (decimal)discountType / 100;
  7.         decimal price = pricePerDay * (decimal)numberOfDays * priceMultiplier;
  8.         decimal discount = price * discountMultiplier;
  9.         decimal totalPrice = price - discount;
  10.  
  11.         return totalPrice;
  12.     }
  13. }
  14.  
  15. public enum Season
  16. {
  17.     spring = 2,
  18.     summer = 4,
  19.     autumn = 1,
  20.     winter = 3
  21. }
  22.  
  23. public enum Discount
  24. {
  25.     none,
  26.     secondvisit = 10,
  27.     vip = 20
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement