예제 #1
0
        static void Main(string[] args)
        {
            Stocked_Item item = new Stocked_Item();

            Console.Write("\nProduto - ");
            item.product = Console.ReadLine();

            Console.Write("\nPreço - ");
            item.price = double.Parse(Console.ReadLine());

            Console.Write("\nQuantidade em estoque - ");
            item.amountInStock = int.Parse(Console.ReadLine());

            Console.WriteLine("\nDados atualizados:\nProduto - " + item.product
                              + "\nPreço - " + item.price
                              + "\nQuantidade em estoque - " + item.amountInStock
                              + "\nValor total - " + item.CalculateTotalValue());

            Console.Write("\nQuantidade a ser adicionada ao estoque - ");
            item.AddToStock(int.Parse(Console.ReadLine()));

            Console.Write("\nQuantidade a ser removida do estoque - ");
            item.SubtractFromStock(int.Parse(Console.ReadLine()));

            Console.WriteLine("\nDados atualizados:\nProduto - " + item.product
                              + "\nPreço - " + item.price
                              + "\nQuantidade em estoque - " + item.amountInStock
                              + "\nValor total - " + item.CalculateTotalValue());
        }
예제 #2
0
        static void Main(string[] args)
        {
            Stocked_Item item = new Stocked_Item();

            Console.Write("\nProduto - ");
            item.product = Console.ReadLine();

            Console.Write("\nPreço - ");
            item.price = double.Parse(Console.ReadLine());

            Console.Write("\nQuantidade em estoque - ");
            item.amountInStock = int.Parse(Console.ReadLine());

            Console.WriteLine(item);

            Console.Write("\nQuantidade a ser adicionada ao estoque - ");
            item.AddToStock(int.Parse(Console.ReadLine()));

            Console.Write("\nQuantidade a ser removida do estoque - ");
            item.SubtractFromStock(int.Parse(Console.ReadLine()));

            Console.WriteLine(item);
        }