Пример #1
0
        void CalculatePrice(NormalTicket ticket)
        {
            int   tariefeenheden = Tariefeenheden.getTariefeenheden(ticket.From, ticket.To);
            float p;

            p = 0.16f * tariefeenheden + 0.82f; // is uit appendix B van Lab 2

            if (ticket.Class == 1)
            {
                p = p * 1.7f;
            }

            if (ticket.International)
            {
                p = p + 2f;
            }

            if (!ticket.Single)
            {
                p = p * 2f;
            }
            p *= amount;

            if (tariefeenheden == 0)
            {
                p = 0f;
            }
            price = p;
        }
Пример #2
0
        private void handlePayment(NormalTicket ticket)
        {
            CalculatePrice(ticket);

            sale = new Sale(price);
            sale.ShowDialog();
            if (paid)
            {
                printer = new Printer1(amount, ticket, price);
                printer.Print();
            }
            paid = false;
        }
Пример #3
0
 public Printer1(int nrTickets, NormalTicket ticket, float price) : base(nrTickets, ticket, price)
 {
     numberofTickets = nrTickets;
     Ticket          = ticket;
     Prijs           = price;
 }