using System.Collections.Generic;
using System.Threading.Tasks;
public string PName { get; set; }
public double Price { get; set; }
public double PriceWithSalesTax { get; set; }
public string productName { get; set; }
public double productPrice { get; set; }
public int productID { get; set; }
public char productType { get; set; }
public ProductClass(string pName,int pID,double pPrice,char pType)
public interface ISalesTax
double SalesTax(char productType,double productPrice);
class SalesTaxlCass:ISalesTax
public double productPricewithST { get; set; }
public double SalesTax(char productType,double productPrice)
productPricewithST = productPrice + (productPrice * 0.2);
productPricewithST = productPrice + (productPrice * 0.1);
productPricewithST = productPrice;
return productPricewithST;
static void Main(string[] args)
List<ProductClass> pList = new List<ProductClass>();
List<BillClass> TotalBillList = new List<BillClass>();
Console.WriteLine("Please Choose the preffered Service:");
Console.WriteLine("1.Add Product \n2.Genrate Bill\n3.Exit");
Choice = Convert.ToInt32(Console.ReadLine());
Console.Write("Please Enter Number of product to enter : ");
int count = Convert.ToInt32(Console.ReadLine());
ProductClass[] prod=new ProductClass[count];
for (int i = 0; i < count; i++)
prod[i]=new ProductClass();
Console.WriteLine("Please Enter Product Details Below\n");
Console.Write("Name : ");
prod[i].productName = Console.ReadLine();
prod[i].productID = Convert.ToInt32(Console.ReadLine());
Console.Write("Type : ");
prod[i].productType = Convert.ToChar(Console.ReadLine());
Console.Write("Price : ");
prod[i].productPrice = Convert.ToDouble(Console.ReadLine());
if (pList.Count == count)
Console.WriteLine("All the product Added Sucessfully");
Console.WriteLine("Billing\n");
Console.WriteLine("1.ADD\n2.Total\n");
opration = Convert.ToInt32(Console.ReadLine());
BillClass bill=new BillClass();
Console.Write("Enter Product ID : ");
int pId=Convert.ToInt32(Console.ReadLine());
var product = (from p in pList
SalesTaxlCass st = new SalesTaxlCass();
TotalBill= st.SalesTax(Convert.ToChar(product[0].productType),Convert.ToDouble(product[0].productPrice));
bill.PName = product[0].productName.ToString();
bill.Price =Convert.ToDouble(product[0].productPrice);
bill.PriceWithSalesTax = TotalBill;
Console.WriteLine("Name \t Price \t Toatl With Sales Tax");
for (int i = 0; i < TotalBillList.Count; i++)
Console.WriteLine(TotalBillList[i].PName + " \t " + TotalBillList[i].Price + " \t " + TotalBillList[i].PriceWithSalesTax);
FinalBill += +TotalBillList[i].PriceWithSalesTax;
Console.WriteLine("\nFinal Bill: "+FinalBill );
default: Console.WriteLine("Please Choose valid Input");
Console.WriteLine("Please choose the valid option");