-
Notifications
You must be signed in to change notification settings - Fork 0
/
MegaStore.cs
36 lines (33 loc) · 904 Bytes
/
MegaStore.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using System;
public class MegaStore
{
public enum DiscountType
{
Standard,
Seasonal,
Weight
}
public static double GetDiscountedPrice(double cartWeight, double totalPrice, DiscountType discountType)
{
switch (discountType)
{
case DiscountType.Seasonal:
return totalPrice - (totalPrice * 0.12);
case DiscountType.Weight:
if (cartWeight > 10)
{
return totalPrice - (totalPrice * 0.18);
}
else
{
return totalPrice - (totalPrice * 0.06);
}
default:
return totalPrice - (totalPrice * 0.06);
}
}
public static void Main(string[] args)
{
Console.WriteLine(GetDiscountedPrice(12, 100, DiscountType.Weight));
}
}