Exemplo n.º 1
0
        public static string GetRowCinemaGoer(CinemaGoer cinemaGoer)
        {
            var res = string.Format("{0} ---> {1} {2} kr \n", cinemaGoer.Age.ToString().PadRight(5),
                                    CinemaTickets.TicketTypeToString(cinemaGoer.Ticket.TicketType).PadRight(20),
                                    cinemaGoer.Ticket.Fee.ToString()
                                    );

            return(res);
        }
Exemplo n.º 2
0
        public static List <CinemaGoer> GetDummyCinemaGoers()
        {
            List <CinemaGoer> res = new List <CinemaGoer>();

            var ages = new int[] { 4, 5, 19, 20, 64, 65, 100, 101 };

            foreach (var age in ages)
            {
                var cinemaGoer = new CinemaGoer(age);
                res.Add(cinemaGoer);
            }
            return(res);
        }
Exemplo n.º 3
0
        static List <CinemaGoer> AddCinemaGoers(int numParticipants)
        {
            List <CinemaGoer> res = new List <CinemaGoer>();

            for (var i = 0; i <= numParticipants - 1; i++)
            {
                ConsoleInteraction.WriteLine("\nAnge ålder på deltagare " + (i + 1).ToString() + ":");

                //var row = ConsoleInteraction.GetCursorRow();
                var userInput = ConsoleInteraction.ReadLine();

                if (!int.TryParse(userInput, out int age))
                {
                    ConsoleInteraction.WriteLine(UserDialog.FaultyInputMessage);
                }

                var cinemaGoer = new CinemaGoer(age);
                res.Add(cinemaGoer);
            }
            return(res);
        }