コード例 #1
0
        /// <summary>
        /// Prints the symbols.
        /// </summary>
        public void PrintSymbols()
        {
            StackCommercial symbolStack = FileOperation.ReadStockSymbol();

            Console.WriteLine("your currently purchased symbols are ");
            while (!symbolStack.IsEmpty())
            {
                Console.WriteLine(symbolStack.PopFromStack() + " ");
            }
        }
コード例 #2
0
        /// <summary>
        /// Writes the symbol.
        /// </summary>
        /// <param name="symbolStack">The symbol stack.</param>
        public static void WriteSymbol(StackCommercial symbolStack)
        {
            List <string> symbolList = new List <string>();

            while (!symbolStack.IsEmpty())
            {
                symbolList.Add(symbolStack.PopFromStack());
            }

            string jsonData = JsonConvert.SerializeObject(symbolList);

            System.IO.File.WriteAllText(@"C:\Users\Admin\source\repos\OOPSProgramming\OOPSProgramming\CommercialDataProcessing\StockAccount.json", jsonData);
        }
コード例 #3
0
        /// <summary>
        /// Reads the stock symbol.
        /// </summary>
        /// <returns>returning stackSymbol</returns>
        public static StackCommercial ReadStockSymbol()
        {
            StackCommercial symbolStack = new StackCommercial();

            symbolStack.StackCommercial1(1000);

            ////getting list of stock list
            List <ShareList> stockList = ReadFromFile();

            ////pusihing all symbol to the custom stack
            foreach (ShareList list in stockList)
            {
                symbolStack.PushIntoStack(list.Symbol);
            }

            return(symbolStack);
        }