public static string[] items = new string[] { "chicken", "footlong", "Siomai", "siopao" };
public static double[] prices = new double[] { 57, 20, 10, 24};
public static int[] stocks = new int[] { 100, 100, 100, 100 };
public static bool selectService = true;
public static double grandtotal = 0;
private static StringBuilder sb = new StringBuilder();
public static void Main(string[] args)
sb.AppendLine("-----------------------------------------------------------------");
sb.AppendLine("------------------------Menu ---------------------------");
sb.AppendLine("-----------------------------------------------------------------");
sb.AppendLine("Item Description \tQuantity \tPrice \tTotal");
Console.WriteLine("-----------------------------------------------------------------");
Console.WriteLine("------------------------ Show Menu ---------------------------");
Console.WriteLine("-----------------------------------------------------------------");
Console.WriteLine("A. Buying\nB. Selling\nC. Adjust Price\nD. Adjust Inventory\nE. Menu\nF. Inventory\nG. Exit");
Console.Write("\nSelect Service:\t");
string service = Console.ReadLine().ToUpper();
bool selectBuyCode = true;
Console.Write("Enter code you want to buy stocks:\t");
int code = int.Parse(Console.ReadLine());
Console.WriteLine("Stocks on hand:" + stocks[index]);
Console.Write("Enter stocks you want to buy:\t");
int addstocks = int.Parse(Console.ReadLine());
Buying(index, addstocks);
bool selectSellCode = true;
Console.Write("Enter code you want to purchase:\t");
int code = int.Parse(Console.ReadLine());
double price = prices[index];
Console.WriteLine("Available Stocks: " + stocks[index]);
Console.Write("Enter quantity:\t");
int quantity = int.Parse(Console.ReadLine());
if(quantity <= stocks[index])
Selling(index, quantity, price);
Console.WriteLine("Quantity must be less than or equal to the current stocks. Please try again!");
} while (selectSellCode);
bool selectPriceCode = true;
Console.Write("Enter code you want to update price:\t");
int code = int.Parse(Console.ReadLine());
Console.WriteLine("Current Price:" + prices[index]);
Console.Write("Enter Your New Price:\t");
double newprice = double.Parse(Console.ReadLine());
AdjustPrice(index, newprice);
} while (selectPriceCode);
bool selectStocksCode = true;
Console.Write("Enter the code that you want to update stocks:\t");
int code = int.Parse(Console.ReadLine());
Console.WriteLine("Stocks on hand:" + stocks[index]);
bool selectMethod = true;
Console.WriteLine("1. Add Stocks");
Console.WriteLine("2. Remove Stocks");
Console.WriteLine("Select Method (1 or 2 only):\t");
int method = int.Parse(Console.ReadLine());
if (method == 1 || method == 2)
Console.Write("Enter updated stocks:\t");
int updatedstocks = int.Parse(Console.ReadLine());
AdjustInventory(index, method, updatedstocks);
selectStocksCode = false;
} while (selectStocksCode);
Console.WriteLine("End of the Program");
Console.WriteLine("Invalid request. Please try again!");
public static void Receipt()
Console.WriteLine("Your total is " + grandtotal.ToString("#,##0.00"));
public static void Selling(int idx, int qty, double price)
double total = qty * price;
sb.AppendLine("\t" + items[idx] + "\t\t" + qty + "\t\t" + price.ToString("#,##0.00") + "\t" + total.ToString("#,##0.00"));
stocks[idx] = stocks[idx] - qty;
public static void Buying(int index, int addstocks)
stocks[index] = stocks[index] + addstocks;
Console.WriteLine("The Stocks has been updated successfully!");
public static void AdjustInventory(int index, int method, int updatedstocks)
stocks[index] = stocks[index] + updatedstocks;
if (updatedstocks <= stocks[index]) stocks[index] = stocks[index] - updatedstocks;
Console.WriteLine("Updated stocks must be less than or equal to the current stocks!");
Console.WriteLine("The Stocks has been updated successfully!");
public static void AdjustPrice(int index, double newprice)
prices[index] = newprice;
Console.WriteLine("Your Price has been updated successfully!");
public static void ShowMenu()
Console.WriteLine("------------------------MENU ------------------------------");
Console.WriteLine(" CODE NAME\t\t FOOD NAME\t\t PRICE");
Console.WriteLine("-----------------------------------------------------------------");
for (int i = 0; i < items.Length; i++)
Console.WriteLine((i+1) + "\t\t\t\t" + (items[i]) + "\t\t\t\t" + (prices[i]));
public static void ShowInventory()
Console.WriteLine("---------------------- INVETORY ----------------------------");
Console.WriteLine(" Category\t\t NAME\t\t STOCKS ON HAND");
Console.WriteLine("-----------------------------------------------------------------");
for (int i = 0; i < items.Length; i++)
Console.WriteLine((i + 1) + "\t\t\t\t" + (items[i]) + "\t\t\t\t" + (stocks[i]));