Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            string[] command = Console.ReadLine().Split();

            while (command[0] != "End")
            {
                BeerCounter.BuyBeer(int.Parse(command[0]));
                BeerCounter.DrinkBeer(int.Parse(command[1]));

                command = Console.ReadLine().Split();
            }
            Console.WriteLine(BeerCounter.stock + " " + BeerCounter.drunkBeers);
            Console.ReadKey();
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            string command = Console.ReadLine();

            while (command != "End")
            {
                int[] input = command.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();

                BeerCounter.BuyBeer(input[0]);
                BeerCounter.DrinkBeer(input[1]);

                command = Console.ReadLine();
            }

            Console.WriteLine($"{BeerCounter.beerInStock} {BeerCounter.beersDrankCount}");
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            string command     = Console.ReadLine();
            int    beersBought = 0;
            int    beersDrunk  = 0;

            while (command != "End")
            {
                string[] splits = command.Split(' ');
                beersBought = Int32.Parse(splits[0]);
                beersDrunk  = Int32.Parse(splits[1]);

                BeerCounter.BuyBeer(beersBought);
                BeerCounter.DrinkBeer(beersDrunk);
                command = Console.ReadLine();
            }

            Console.WriteLine("Beers remaining in Stock : {0}, Beers Drunk: {1}", BeerCounter.beerInStock, BeerCounter.beerDrankCount);
        }
Ejemplo n.º 4
0
        static void Main(string[] args)
        {
            var input = Console.ReadLine();

            while (!input.Equals("End"))
            {
                var beers = input
                            .Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
                            .Select(int.Parse)
                            .ToArray();

                BeerCounter.BuyBeer(beers[0]);
                BeerCounter.DrinkBeer(beers[1]);

                input = Console.ReadLine();
            }

            Console.WriteLine($"{BeerCounter.beerInStock} {BeerCounter.beerDrankCount}");
        }