Ejemplo n.º 1
0
        public static void Main(string[] args)
        {
            // Try your code here, if you want

            PaymentTerminal lunchCafeteria = new PaymentTerminal();

            Console.WriteLine(lunchCafeteria);

            PaymentCard annesCard = new PaymentCard(2);

            Console.WriteLine("amount of money on the card is " + annesCard.balance + " euros");

            bool wasSuccessful = lunchCafeteria.EatLunch(annesCard);

            Console.WriteLine("there was enough money: " + wasSuccessful);

            lunchCafeteria.AddMoneyToCard(annesCard, 100);

            wasSuccessful = lunchCafeteria.EatLunch(annesCard);
            Console.WriteLine("there was enough money: " + wasSuccessful);

            Console.WriteLine("amount of money on the card is " + annesCard.balance + " euros");

            Console.WriteLine(lunchCafeteria);
        }
Ejemplo n.º 2
0
        public static void Main(string[] args)
        {
            PaymentCard petesCard = new PaymentCard(10);

            Console.WriteLine("money " + petesCard.balance);
            bool wasSuccessful = petesCard.TakeMoney(8);

            Console.WriteLine("successfully withdrew: " + wasSuccessful);
            Console.WriteLine("money " + petesCard.balance);

            wasSuccessful = petesCard.TakeMoney(4);
            Console.WriteLine("successfully withdrew: " + wasSuccessful);
            Console.WriteLine("money " + petesCard.balance);
        }
Ejemplo n.º 3
0
        public static void Main(string[] args)
        {
            // Try your code here, if you want
            PaymentTerminal lunchCafeteria = new PaymentTerminal();

            double change = lunchCafeteria.DrinkCoffee(10);

            Console.WriteLine("remaining change: " + change);

            PaymentCard annesCard = new PaymentCard(15);

            bool wasSuccessful = lunchCafeteria.EatLunch(annesCard);

            Console.WriteLine("there was enough money: " + wasSuccessful);
            wasSuccessful = lunchCafeteria.EatLunch(annesCard);
            Console.WriteLine("there was enough money: " + wasSuccessful);
            wasSuccessful = lunchCafeteria.DrinkCoffee(annesCard);
            Console.WriteLine("there was enough money: " + wasSuccessful);

            Console.WriteLine(lunchCafeteria);
        }
Ejemplo n.º 4
0
        public static void Main(string[] args)
        {
            // Try your code here, if you want

            /*section 1
             * PaymentCard petesCard = new PaymentCard(10);
             *
             * Console.WriteLine("money " + petesCard.balance);
             * bool wasSuccessful = petesCard.TakeMoney(8);
             * Console.WriteLine("successfully withdrew: " + wasSuccessful);
             * Console.WriteLine("money " + petesCard.balance);
             *
             * wasSuccessful = petesCard.TakeMoney(4);
             * Console.WriteLine("successfully withdrew: " + wasSuccessful);
             * Console.WriteLine("money " + petesCard.balance);*/

            /*section 2
             * PaymentTerminal lunchCafeteria = new PaymentTerminal();
             *
             * double change = lunchCafeteria.DrinkCoffee(10);
             * Console.WriteLine("remaining change " + change);
             *
             * change = lunchCafeteria.DrinkCoffee(5);
             * Console.WriteLine("remaining change " + change);
             *
             * change = lunchCafeteria.EatLunch(20);
             * Console.WriteLine("remaining change " + change);
             *
             * Console.WriteLine(lunchCafeteria);*/

            /*section 3
             * PaymentTerminal lunchCafeteria = new PaymentTerminal();
             *
             * double change = lunchCafeteria.DrinkCoffee(10);
             * Console.WriteLine("remaining change: " + change);
             *
             * PaymentCard annesCard = new PaymentCard(15);
             *
             * bool wasSuccessful = lunchCafeteria.EatLunch(annesCard);
             * Console.WriteLine("there was enough money: " + wasSuccessful);
             * wasSuccessful = lunchCafeteria.EatLunch(annesCard);
             * Console.WriteLine("there was enough money: " + wasSuccessful);
             * wasSuccessful = lunchCafeteria.DrinkCoffee(annesCard);
             * Console.WriteLine("there was enough money: " + wasSuccessful);
             *
             * Console.WriteLine(lunchCafeteria);*/

            PaymentTerminal lunchCafeteria = new PaymentTerminal();

            Console.WriteLine(lunchCafeteria);

            PaymentCard annesCard = new PaymentCard(2);

            Console.WriteLine("amount of money on the card is " + annesCard.balance + " euros");

            bool wasSuccessful = lunchCafeteria.EatLunch(annesCard);

            Console.WriteLine("there was enough money: " + wasSuccessful);

            lunchCafeteria.AddMoneyToCard(annesCard, 100);

            wasSuccessful = lunchCafeteria.EatLunch(annesCard);
            Console.WriteLine("there was enough money: " + wasSuccessful);

            Console.WriteLine("amount of money on the card is " + annesCard.balance + " euros");

            Console.WriteLine(lunchCafeteria);
        }