public void boardFirstClass(FirstClass firstClass) { this.firstClass = firstClass; totalBaggageWeight += firstClass.getBaggageWeight(); if (totalBaggageWeight > maxBaggageWeight) { Console.WriteLine("Baggage weight bigger then max value"); } }
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)); }
//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); }