Beispiel #1
0
        public IPilot HirePilot(string name)
        {
            IPilot pilot = new Pilot(name);
            var    k     = this.pilots.Any(x => x.Name.Equals(name));

            if (k)
            {
                throw new ArgumentException("Alredy has pilot with this name!");
            }
            else
            {
                this.pilots.Add(pilot);
            }
            return(pilot);
        }
        //private MachineFactory() { }

        //public static MachineFactory MFInstance
        //{
        //   get
        //   {
        //      if (instance == null)
        //      {
        //         instance = new MachineFactory();
        //      }
        //      return instance;
        //   }
        //}


        public IPilot HirePilot(string name)
        {
            IPilot newPilot = new Pilot(name);

            foreach (var pilot in alreadyHired)
            {
                if (name == pilot)
                {
                    string pilotString = String.Format("Pilot {0} hired", name);
                    throw new IndexOutOfRangeException(pilotString);
                }
            }
            alreadyHiredPilots.Add(newPilot);
            alreadyHired.Add(name);
            return(newPilot);
        }
Beispiel #3
0
        public IPilot HirePilot(string name)
        {
            Pilot p = new Pilot(name);

            return(p);
        }
Beispiel #4
0
        public IPilot HirePilot(string name)
        {
            Pilot newPilot = new Pilot(name);

            return(newPilot);
        }