コード例 #1
0
        public override SeatInformation GetSeatInformation(int seatNumber)
        {
            SeatCategory category = new SeatCategory();
            SeatSection  section  = new SeatSection();

            if (seatNumber % 3 == 1)
            {
                section  = SeatSection.LeftSide;
                category = SeatCategory.Singular;
            }
            else
            {
                section = SeatSection.RightSide;
                if (seatNumber % 3 == 2)
                {
                    category = SeatCategory.Corridor;
                }
                else if (seatNumber % 3 == 0)
                {
                    category = SeatCategory.Window;
                }
            }
            SeatInformation seatInformation = new SeatInformation(seatNumber, section, category);

            return(seatInformation);
        }
コード例 #2
0
 internal Ticket(BusExpedition expedition, SeatInformation seatInformation, Person passenger, decimal paidAmount)
 {
     Expedition      = expedition;
     SeatInformation = seatInformation;
     Passenger       = passenger;
     PaidAmount      = paidAmount;
 }
コード例 #3
0
 internal Ticket(BusExpedition Expedition, SeatInformation SeatInformation, Person Passenger, decimal PaidAmount)
 {
     this.Expedition      = Expedition;
     this.SeatInformation = SeatInformation;
     this.Passenger       = Passenger;
     this.PaidAmount      = PaidAmount;
 }
コード例 #4
0
        public override SeatInformation GetSeatInformation(int seatNumber)
        {
            SeatSection section = (seatNumber % 2 == 0)
               ? SeatSection.RightSide : SeatSection.LeftSide;
            SeatCategory category = SeatCategory.Window;

            SeatInformation inf = new SeatInformation(seatNumber, section, category);

            return(inf);
        }
コード例 #5
0
        public override SeatInformation GetSeatInformation(int seatNumber)
        {
            SeatSection section = (seatNumber % 3 == 1)
               ? SeatSection.LeftSide : SeatSection.RightSide;
            SeatCategory category = (seatNumber % 3 == 1) ? SeatCategory.Singular
                : (seatNumber % 3 == 2) ? SeatCategory.Corridor
                : SeatCategory.Window;

            SeatInformation inf = new SeatInformation(seatNumber, section, category);

            return(inf);
        }
コード例 #6
0
        public SeatInformation GetSeatInformation(int SeatNumber)
        {
            SeatInformation seatInformation;

            if (SeatNumber < 0 || SeatNumber > Bus.Capacity)
            {
                throw new ArgumentOutOfRangeException(nameof(SeatNumber));
            }
            if (Bus is StandardBus)
            {
                switch (SeatNumber % 3)
                {
                case 1:
                    seatInformation = new SeatInformation(SeatNumber, SeatSection.LeftSide, SeatCategory.Singular);
                    break;

                case 2:
                    seatInformation = new SeatInformation(SeatNumber, SeatSection.None, SeatCategory.Corridor);
                    break;

                case 0:
                    seatInformation = new SeatInformation(SeatNumber, SeatSection.RightSide, SeatCategory.Window);
                    break;

                default:
                    throw new ArgumentOutOfRangeException(nameof(SeatNumber));
                }
            }
            else
            {
                switch (SeatNumber % 2)
                {
                case 1:
                    seatInformation = new SeatInformation(SeatNumber, SeatSection.LeftSide, SeatCategory.Singular);
                    break;

                case 0:
                    seatInformation = new SeatInformation(SeatNumber, SeatSection.RightSide, SeatCategory.Singular);
                    break;

                default:
                    throw new ArgumentOutOfRangeException(nameof(SeatNumber));
                }
            }
            return(seatInformation);
        }
コード例 #7
0
        public override SeatInformation GetSeatInformation(int seatNumber)
        {
            SeatSection  section  = new SeatSection();
            SeatCategory category = new SeatCategory();

            if (seatNumber % 2 == 1)
            {
                section = SeatSection.LeftSide;
            }
            else
            {
                section = SeatSection.RightSide;
            }
            category = SeatCategory.Singular;
            SeatInformation seatInf = new SeatInformation(seatNumber, section, category);

            return(seatInf);
        }
コード例 #8
0
        public decimal GetPriceOf(int seatNumber)                               //Fiyat Alın
        {
            SeatInformation seatInf = new SeatInformation();

            if (Bus is LuxuryBus)
            {
                return(Route.BasePrice * 135 / 100);
            }
            else
            {
                if (seatInf.Section == SeatSection.LeftSide)
                {
                    return(Route.BasePrice * 125 / 100);
                }
                else
                {
                    return(Route.BasePrice * 120 / 100);
                }
            }
        }