protected void Page_Load(object sender, EventArgs e) { ProductCatalog pc = new ProductCatalog(); pc.AddProduct("Radiation Blaster 3000", 150M, "microwave.jpg"); pc.AddProduct("Fruit Ninja", 70M, "mixer.jpg"); pc.AddProduct("Toasty Buns", 20M, "toaster.jpg"); Response.Write(pc.GetCatalogHtml()); TaxableProduct tp = (TaxableProduct)pc.GetHighPricedProduct(); Response.Write("The high priced product is: " + tp.Name + " at a price of $" + tp.TotalPrice); }
protected void Page_Load(object sender, EventArgs e) { ProductCatalog pc = new ProductCatalog(); pc.AddProduct("The Scorcher", 1000, "microwave.jpg"); pc.AddProduct("The Whirlpool", 500, "mixer.jpg"); pc.AddProduct("Buns Burner", 700, "toaster.jpg"); Response.Write(pc.getCatalogHtml()); TaxableProduct highProd = (TaxableProduct)pc.GetHighPricedProduct(); Response.Write("The most Expensive product is: " + highProd.Name + " at $" + highProd.TotalPrice); }
// methods public void AddProduct(string name, decimal price, string imageUrl) { TaxableProduct product = new TaxableProduct(name, price, imageUrl); products.Add(product); }
public void AddProduct(string name, decimal price, string imageUrl) { TaxableProduct tp = new TaxableProduct(name, price, imageUrl); products.Add(tp); }