using System.Collections.Generic;
public double Qty { get; set; }
public string Name { get; set; }
public double Price { get; set; }
public double Tax { get; set; }
public Product(int qty, string name, double price, double tax)
static void getTax(Product obj)
Console.WriteLine("{0} {1} at {2} Tax {3}", obj.Qty, obj.Name, obj.Price, obj.Tax);
static void Main(string[] args)
Console.WriteLine("Scenario 1:");
List<Product> ProductList = new List<Product>();
ProductList.Add(new Product(1, "book", 10, 5));
ProductList.Add(new Product(1, "music CD", 20, 0));
ProductList.ForEach(getTax);
double res = ProductList.Sum(x => x.Tax);
Console.WriteLine("Sales: " + res);