Exemplo n.º 1
0
        public Tuple <int, double>[] PriceCalculator(int x, Movies y, bool z)
        {
            Tuple <int, double>[] collector = new Tuple <int, double> [x];
            for (int i = 0; i < x; i++)
            {
                Console.WriteLine("Voer persoon " + (i + 1) + " zijn/haar leeftijd in.");
                int personIage = -1;
                while (personIage < 0 || personIage > 120)
                {
                    try
                    {
                        personIage = int.Parse(Console.ReadLine());
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine("Voert u a.u.b. de leeftijd van de tickethouder in.");
                    }

                    if (personIage < 1)
                    {
                        Console.WriteLine("Leeftijd kan niet kleiner dan 1 zijn.");
                    }
                    if (personIage > 120)
                    {
                        Console.WriteLine("Leeftijd kan niet groter dan 120 zijn.");
                    }
                }
                double personIprice = MoviePrice.calcTicketPrice(movie, personIage, IsVip);
                collector[i] = Tuple.Create(personIage, personIprice);
            }
            return(collector);
        }