Example #1
0
 private static void PrintTickets(CinemaTicket tickets)
 {
     Console.WriteLine("------------------");
     Console.WriteLine("Total price");
     tickets.PrintType();
     Console.WriteLine("Total: {0:C}", tickets.ComputeSum());
 }
Example #2
0
        private static void CalculateCinemaTicketPrice()
        {
            Console.Clear();
            Console.WriteLine("This program will print out your cinema price");
            CinemaTicket tickets = new CinemaTicket();

            InputTickets(tickets);
            PrintTickets(tickets);
            Console.ReadLine();
        }
Example #3
0
 private static void InputTickets(CinemaTicket tickets)
 {
     Console.Write("Number of person to buy:");
     try
     {
         int n = Int32.Parse(Console.ReadLine());
         for (int i = 0; i < n; i++)
         {
             Console.Write("Please input the age of person " + (i + 1).ToString() + ":");
             int age = Int32.Parse(Console.ReadLine());
             tickets.AddTicket(age);
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine("Something went wrong!");
         Console.WriteLine(ex.Message);
     }
 }