Esempio n. 1
0
        public static List <Ship> AllCaptainsAgeLessThan35(Port port)
        {
            List <Ship> ships = new List <Ship>();
            uint        age   = 35;

            foreach (Ship ship in port.GetShips())
            {
                if (ship.CaptainAge < age)
                {
                    ships.Add(ship);
                }
            }
            return(ships);
        }
Esempio n. 2
0
        public static uint SteamerSeats(Port port)
        {
            uint seats          = 0;
            uint seatsOnSteamer = 10;

            foreach (Ship ship in port.GetShips())
            {
                if (ship.ToString() == "Steamer")
                {
                    seats += seatsOnSteamer;
                }
            }
            return(seats);
        }
Esempio n. 3
0
        public static uint SteamerSeats(Port port)
        {
            uint seats = 0;

            foreach (Ship ship in port.GetShips())
            {
                Steamer steamer = ship as Steamer;
                if (steamer != null)
                {
                    seats += steamer.Seats;
                }
            }
            return(seats);
        }
Esempio n. 4
0
        public static double CalculateDisplacement(Port port)
        {
            double displacement = 0;
            double draft        = 6.5F;
            double width        = 14;

            foreach (Ship ship in port.GetShips())
            {
                if (ship.ToString() == "Sailboat")
                {
                    displacement += draft * width * ship.Delta;
                }
            }
            Debug.Assert(displacement != 0, "В порту нет парусников?((");
            return(displacement);
        }
Esempio n. 5
0
        public static double CalculateDisplacement(Port port)
        {
            double displacement = 0;
            double draft        = 6.5F;
            double width        = 14;
            double delta        = 0.45F;
            double result       = draft * width * delta;

            foreach (Ship ship in port.GetShips())
            {
                if (ship.ToString() == "Sailboat")
                {
                    displacement += result;
                }
            }
            return(displacement);
        }