using System.Collections.Generic;
namespace ECommercePlatform
static void Main(string[] args)
List<Product> products = new List<Product>();
products.Add(new Product("001", "iPhone 12", 1099.99));
products.Add(new Product("002", "Samsung Galaxy S21", 999.99));
products.Add(new Product("003", "Google Pixel 5", 899.99));
Console.WriteLine("Welcome to the E-Commerce Platform!");
Console.WriteLine("Available Products:");
Console.WriteLine("--------------------");
foreach (Product product in products)
Console.WriteLine("{product.Id} - {product.Name} - ${product.Price}");
Console.WriteLine("--------------------");
Console.WriteLine("Enter the product ID you want to purchase (or 'exit' to quit):");
string input = Console.ReadLine();
Product selectedProduct = null;
foreach (Product product in products)
selectedProduct = product;
if (selectedProduct != null)
Console.WriteLine("You have selected: {selectedProduct.Name} - ${selectedProduct.Price}");
Console.WriteLine("Please enter your payment information:");
string paymentInfo = Console.ReadLine();
Console.WriteLine("Processing payment...");
Console.WriteLine("Payment successful! Your order has been placed.");
Console.WriteLine("Invalid product ID. Please try again.");
Console.WriteLine("Enter the product ID you want to purchase (or 'exit' to quit):");
input = Console.ReadLine();
Console.WriteLine("Thank you for using the E-Commerce Platform. Goodbye!");
public string Id { get; set; }
public string Name { get; set; }
public double Price { get; set; }
public Product(string id, string name, double price)