using System; using System.Collections.Generic; class Program { static void Mai

using System;
using System.Collections.Generic;
class Program
{
static void Main(string[] args)
{
List menu = new List();
while (true)
{
Console.WriteLine(“Restaurant Menu Management System”);
Console.WriteLine(“1. Add Menu Item”);
Console.WriteLine(“2. Display Menu”);
Console.WriteLine(“3. Exit”);
Console.Write(“Enter your choice: “);
if (int.TryParse(Console.ReadLine(), out int choice))
{
switch (choice)
{
case 1:
AddMenuItem(menu);
break;
case 2:
DisplayMenu(menu);
break;
case 3:
Environment.Exit(0);
break;
default:
Console.WriteLine(“Invalid choice. Please try again.”);
break;
}
}
else
{
Console.WriteLine(“Invalid input. Please enter a number.”);
}
}
}
static void AddMenuItem(List menu)
{
Console.Write(“Enter the item name: “);
string name = Console.ReadLine();
Console.Write(“Enter the item description: “);
string description = Console.ReadLine();
Console.Write(“Enter the item price: “);
if (decimal.TryParse(Console.ReadLine(), out decimal price))
{
MenuItem menuItem = new MenuItem(name, description, price);
menu.Add(menuItem);
Console.WriteLine(“Item added to the menu.”);
}
else
{
Console.WriteLine(“Invalid price. Please enter a valid number.”);
}
}
static void DisplayMenu(List menu)
{
Console.WriteLine(“Restaurant Menu:”);
foreach (MenuItem item in menu)
{
Console.WriteLine($”{item.Name} – {item.Description} – ${item.Price}”);
}
}
}
class MenuItem
{
public string Name { get; }
public string Description { get; }
public decimal Price { get; }
public MenuItem(string name, string description, decimal price)
{
Name = name;
Description = description;
Price = price;
}
}

Posted in C++

Place this order or similar order and get an amazing discount. USE Discount code “GET20” for 20% discount