public delegate string PromoLvl(double amnt);
public double t1Percent = 0.10;
public double t2Percent = 0.15;
public double t3Percent = 0.25;
public double UsrAmnt { get; set; }
public double ProcessDiscount(double amnt, double percentage)
var discount = amnt * percentage;
Console.WriteLine("You saved: $" + string.Format("{0:n}", discount));
public string LvlOne(double amnt)
var result = ProcessDiscount(amnt, t1Percent);
return "Tier One 10% discount. You pay $" + string.Format("{0:n}", result);
public string LvlTwo(double amnt)
var result = ProcessDiscount(amnt, t2Percent);
return "Tier Two 15% discount. You pay $" + string.Format("{0:n}", result);
public string LvlThree(double amnt)
var result = ProcessDiscount(amnt, t3Percent);
return "Tier Three 25% discount. You Pay $" + string.Format("{0:n}", result);
public double GetAmount()
Promotion promo = new Promotion();
string amnt = string.Empty;
Console.WriteLine("Enter a numeric value... press Enter");
amnt = Console.ReadLine();
if(double.TryParse(amnt, out num))
while (string.IsNullOrEmpty(amnt) | !isNum);
promo.UsrAmnt = double.Parse(amnt);
public PromoTier GetPromoTier()
Random rand = new Random();
int randNum = rand.Next(0, 3);
PromoTier randTier = PromoTier.TierOne;
randTier = PromoTier.TierOne;
randTier = PromoTier.TierTwo;
randTier = PromoTier.TierThree;
public void DisplayAmnt(double amnt)
Console.WriteLine(string.Format("Total before discount ${0}", amnt));
public void displayDiscount(PromoTier tier, double total)
Promotion promo = new Promotion();
if (tier == PromoTier.TierOne)
PromoLvl myPromo = new PromoLvl(promo.LvlOne);
Console.WriteLine(myPromo(total));
else if (tier == PromoTier.TierTwo)
PromoLvl myPromo = new PromoLvl(promo.LvlTwo);
Console.WriteLine(myPromo(total));
PromoLvl myPromo = new PromoLvl(promo.LvlThree);
Console.WriteLine(myPromo(total));
public static void Main()
Console.WriteLine("Awesome Promotion Discount Calculator");
Program prgrm = new Program();
PromoTier promoTier = prgrm.GetPromoTier();
double amount = prgrm.GetAmount();
prgrm.displayDiscount(promoTier, amount);