Exemplo n.º 1
0
 public void boardFirstClass(FirstClass firstClass)
 {
     this.firstClass     = firstClass;
     totalBaggageWeight += firstClass.getBaggageWeight();
     if (totalBaggageWeight > maxBaggageWeight)
     {
         Console.WriteLine("Baggage weight bigger then max value");
     }
 }
Exemplo n.º 2
0
        private UIInfo getUIInfo()
        {
            Class cls;

            if (firstClass.Checked)
            {
                cls = new FirstClass();
            }
            else
            {
                cls = new SecondClass();
            }

            TicketType way;

            if (oneWay.Checked)
            {
                way = new OneWay();
            }
            else
            {
                way = new Return();
            }

            Discount dis;

            if (twentyDiscount.Checked)
            {
                dis = new TwentyDiscount();
            }
            else if (fortyDiscount.Checked)
            {
                dis = new FortyDiscount();
            }
            else
            {
                dis = new NoDiscount();
            }

            PaymentMethod pment;

            if (payment.SelectedIndex == 0)
            {
                pment = new CreditCard();
            }
            else if (payment.SelectedIndex == 1)
            {
                pment = new DebitCard();
            }
            else
            {
                pment = new CoinMachine();
            }

            return(new UIInfo(Station.findStation(fromBox.SelectedItem.ToString()), Station.findStation(toBox.SelectedItem.ToString()), cls, way, dis, pment));
        }
Exemplo n.º 3
0
        //Chooses the correct Seatclass
        public static SeatClass GetClass(UIClass info)
        {
            SeatClass seatclass = null;

            switch (info)
            {
            case UIClass.FirstClass: seatclass = new FirstClass(); break;

            case UIClass.SecondClass: seatclass = new SecondClass(); break;
            }
            return(seatclass);
        }