Inheritance: Listing
Exemplo n.º 1
0
        private bool SpawnBoat()
        {
            Vector3 spawnpoint;
            int     spawnAttempts    = 0;
            int     maxSpawnAttempts = (int)Config["MaxSpawnAttempts"];

            do
            {
                spawnpoint = RandomWorldPosition(); spawnAttempts++;
            }while (!CanSpawnBoat(spawnpoint) && spawnAttempts < maxSpawnAttempts);

            if (spawnAttempts == maxSpawnAttempts)
            {
                return(false);
            }

            Quaternion rotation = Quaternion.Euler(0, Random.Next(0, 360), 0);
            MotorBoat  boat     = GameManager.server.CreateEntity("assets/content/vehicles/boats/rowboat/rowboat.prefab", spawnpoint, rotation) as MotorBoat;

            if (boat == null)
            {
                return(false);
            }

            boat.Spawn();
            return(true);
        }
Exemplo n.º 2
0
        public static void Main()
        {
            //------------------------------------------------------------------------
            // Build a collection of all vehicles that fly
            // With a single `foreach`, have each vehicle Fly()
            PassengerPlane plane1 = new PassengerPlane();
            PrivateJet     plane2 = new PrivateJet();
            Spaceship      plane3 = new Spaceship();
            //creat a list of planes
            var planes = new List <Aircraft>();

            planes.Add(plane1);
            planes.Add(plane2);
            planes.Add(plane3);
            //loop over the list with a foreach and call method Fly() for each one
            foreach (var plane in planes)
            {
                plane.Fly();
            }
            //--------------------------------------------------------------------------


            //------------------------------------------------------------------------
            // Build a collection of all vehicles that operate on roads
            // With a single `foreach`, have each road vehicle Drive()
            NissanLeaf  car1 = new NissanLeaf();
            NissanKicks car2 = new NissanKicks();
            NissanRogue car3 = new NissanRogue();
            //creat a list of cars
            var cars = new List <Car>();

            cars.Add(car1);
            cars.Add(car2);
            cars.Add(car3);
            //loop over the list with a foreach and call method Drive() for each one
            foreach (var car in cars)
            {
                car.Drive();
            }
            //--------------------------------------------------------------------------

            //--------------------------------------------------------------------------
            // Build a collection of all vehicles that operate on water
            // With a single `foreach`, have each water vehicle Drive()
            MotorBoat boat1 = new MotorBoat();
            RowBoat   boat2 = new RowBoat();
            Yacht     boat3 = new Yacht();
            //creat a list of boat
            var boats = new List <Watercraft>();

            boats.Add(boat1);
            boats.Add(boat2);
            boats.Add(boat3);
            //loop over the list with a foreach and call method Drive() for each one
            foreach (var boat in boats)
            {
                boat.Drive();
            }
            //--------------------------------------------------------------------------
        }
        public void MotorBoatTest()
        {
            //ASSIGN: Create new test object
            MotorBoat motorBoat = new MotorBoat("123456792", new DateTime(2016, 3, 22, 10, 40, 0), "ABC123456792", new Owner("John", "Johnson", "1809 Pennsylvania Ave", "Washington, D.C."), "Outboard V-16");

            Assert.AreEqual(motorBoat.registrationNumber, "123456792");
            Assert.AreEqual(motorBoat.owner.lastName, "Johnson");
            Assert.AreEqual(motorBoat.engineType, "Outboard V-16");
        }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            const char   DELIM      = ',';
            const string IFILE_NAME = "Customer.txt";
            const string OFILE_NAME = "Boat.txt";



            const int NUM_CUSTOMER = 3;

            Customer[] myCustomers = new Customer[NUM_CUSTOMER];

            FileStream iFile = editFile(IFILE_NAME, FileMode.Open, FileAccess.Read);

            StreamReader reader = checkFileStreamReader(iFile, IFILE_NAME);

            addCustomers(reader, myCustomers, DELIM);


            closeFile(iFile, reader);


            MotorBoat motorboat1 = createMotorboat("9005", 10, "Yamaha Inc", 2012, 2, FuelType.Diesel);


            MotorBoat motorboat2 = createMotorboat("7654", 25, "Bayliner Inc.", 2016, 3, FuelType.Gasoline);


            SailBoat sailboat1 = createSailboat("5142", 15, "Miami Inc.", 1999, 6, 3);



            assignBoat(myCustomers[0], motorboat1);

            assignBoat(myCustomers[1], motorboat2);

            assignBoat(myCustomers[0], sailboat1);

            division(1);
            Console.WriteLine(myCustomers[0]);

            division(2);
            Console.WriteLine(myCustomers[1]);


            FileStream oFile = editFile(OFILE_NAME, FileMode.Create, FileAccess.Write);


            StreamWriter writer = checkFileStreamWriter(oFile, OFILE_NAME);


            printRecords(writer, myCustomers, DELIM);
        }
Exemplo n.º 5
0
        static void Main(string[] args)
        {
            var newSportsCar = new SportsCar(FuelStatus.Empty, "Blue", 4);

            newSportsCar.Drive();
            newSportsCar.Refuel();
            newSportsCar.Brake();

            var newMotorBoat = new MotorBoat(FuelStatus.Full, "Gray", 15);

            newMotorBoat.Drive();
            newMotorBoat.Refuel();
        }
Exemplo n.º 6
0
        static MotorBoat createMotorboat(string regNumber, double length, string manufacturer, int year, int motor, FuelType fuel)
        {
            MotorBoat aMotorboat = null;
            string    exception;

            try
            {
                aMotorboat = new MotorBoat(regNumber, length, manufacturer, year, motor, fuel);
            }
            catch (Exception ex)
            {
                exception  = printError(ex);
                exception += string.Format("A motorboat instance couldn't be created!\n");
                Console.WriteLine(exception);
            }

            return(aMotorboat);
        }
Exemplo n.º 7
0
        static Boat CreateBoat()
        {
            string boatId;
            int    weight, maxSpeed, uniqueProperty;

            switch (random.Next(1, 4 + 1))
            {
            case 1:
                uniqueProperty = random.Next(1, 6 + 1);
                boatId         = CreateBoatId("R-");
                weight         = random.Next(100, 300 + 1);
                maxSpeed       = random.Next(0, 3 + 1);
                Boat rowBoat = new RowBoat(uniqueProperty, boatId, weight, maxSpeed);
                return(rowBoat);

            case 2:
                uniqueProperty = random.Next(10, 1000 + 1);
                boatId         = CreateBoatId("M-");
                weight         = random.Next(200, 3000 + 1);
                maxSpeed       = random.Next(0, 60 + 1);
                Boat motorBoat = new MotorBoat(uniqueProperty, boatId, weight, maxSpeed);
                return(motorBoat);

            case 3:
                uniqueProperty = random.Next(10, 60 + 1);
                boatId         = CreateBoatId("S-");
                weight         = random.Next(800, 6000 + 1);
                maxSpeed       = random.Next(0, 12 + 1);
                Boat sailBoat = new SailBoat(uniqueProperty, boatId, weight, maxSpeed);
                return(sailBoat);

            case 4:
                uniqueProperty = random.Next(0, 500 + 1);
                boatId         = CreateBoatId("C-");
                weight         = random.Next(3000, 20000 + 1);
                maxSpeed       = random.Next(0, 20 + 1);
                Boat cargoBoat = new CargoBoat(uniqueProperty, boatId, weight, maxSpeed);
                return(cargoBoat);

            default:
                return(null);
            }
        }
Exemplo n.º 8
0
    void SetPositions()
    {
        SoundtrackManager.s_instance.PlayAudioSource(SoundtrackManager.s_instance.bell);
        print("SET POS" + scenario);
        switch (scenario)
        {
        case 4:
        {
            hintText.text = "Remember: You give way to them.";
            MotorBoat.transform.position = overrun.position;
            MotorBoat.transform.rotation = overrun.rotation;
            Player.transform.rotation    = starboard.rotation;
            Player.transform.position    = starboard.position;
            MotorBoat.GetComponent <EvilYacht> ().isMoving = true;
            AIboat.SetActive(false);
            break;
        }

        case 2:
        {
            hintText.text    = "Remember: You give way to them.";
            boomSlider.value = 40f;
            AIboat.GetComponent <AIBoat> ().SetTack(false);
            Player.transform.position = windward.position;
            AIboat.transform.position = leeward.position;
            Player.transform.rotation = windward.rotation;
            AIboat.transform.rotation = leeward.rotation;
            AIboat.GetComponent <AIBoat> ().SetMast(scenario);
            currentGraphicCG = windward_LeewardGiveWayCG;

            break;
        }

        case 3:
        {
            hintText.text = "Remember: They give way to you.";
            StartCoroutine("level2");
            boomSlider.value          = 15f;
            Player.transform.rotation = leeward.rotation;
            Player.transform.position = leeward.position;
            AIboat.transform.rotation = windward.rotation;
            AIboat.transform.position = windward.position;
            AIboat.GetComponent <AIBoat> ().SetMast(scenario);

            currentGraphicCG = windward_LeewardStandOnCG;

            break;
        }

        case 0:
        {
            hintText.text = "Remember: They give way to you.";
            StartCoroutine("level3");

            boomSlider.value          = 20f;
            Player.transform.position = starboard.position;
            AIboat.transform.position = port.position;
            Player.transform.rotation = starboard.rotation;
            AIboat.transform.rotation = port.rotation;
            AIboat.GetComponent <AIBoat> ().SetMast(scenario);

            currentGraphicCG = port_StarboardStandOnCG;

            break;
        }

        case 1:
        {
            hintText.text             = "Remember: You give way to them.";
            boomSlider.value          = 14.5f;
            Player.transform.position = port.position;
            Player.transform.rotation = port.rotation;
            AIboat.transform.position = starboard.position;
            AIboat.transform.rotation = starboard.rotation;
            AIboat.GetComponent <AIBoat> ().SetMast(scenario);

            currentGraphicCG = port_StarboardGiveWayCG;

            break;
        }
        }
    }
Exemplo n.º 9
0
 void ToggleBoatMovement(bool thisBool)
 {
     AIboat.GetComponent <Rigidbody> ().isKinematic    = !thisBool;
     Player.GetComponent <Rigidbody> ().isKinematic    = !thisBool;
     MotorBoat.GetComponent <Rigidbody> ().isKinematic = !thisBool;
 }
        public async Task <IHttpActionResult> mockData(int counter)
        {
            string[] Names     = { "Maggie", "Penny", "Magdalena", "Joanna", "Zuzanna", "Tomasz", "Marcin", "Jacek", "Mateusz", "Aleksander", "Jurek", "Abby", "Laila", "Sadie", "Olivia", "Ola", "Starlight", "Talla", "Zbigniew", "Jola" };
            string[] Surenames = { "Poloczek", "Nowak", "Cudzoziemiec", "Kwiatek", "K³y¿", "Ziêba", "Miodek", "Halama", "Nehru", "Boczek", "O³ówek", "Niestolik" };
            string[] City      = { "Sarnów", "Gorzów Wielkopolski", "Warszawa", "Kraków", "Katowice", "Gdañsk", "S³upsk", "Przemyœl", "Bielsko Bia³a", "¯ywiec", "Szczecin", "Poznañ" };
            string[] Email     = { "*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**" };
            string[] Phones    = { "129483958", "837495837", "098273475", "283950392", "898127847", "988372982", "783917284" };
            try
            {
                for (int i = 0; i < counter; i++)
                {
                    int rand = new Random().Next(1, 6);
                    DomainModel.Advert advert = new DomainModel.Advert();
                    advert.AdditionDate          = DateTime.Now;
                    advert.AdditionalInformation = "Brak informacji dodatkowych na temat og³oszenia";
                    advert.City        = City[new Random().Next(0, 11)];
                    advert.Email       = Email[new Random().Next(0, 4)];
                    advert.FinishDate  = DateTime.Now.AddDays(7);
                    advert.Name        = Names[new Random().Next(0, 20)];
                    advert.PhoneNumber = Phones[new Random().Next(0, 6)];
                    advert.SureName    = Surenames[new Random().Next(1, 12)];
                    switch (rand)
                    {
                    case 1:
                        DomainModel.Engine subject = new DomainModel.Engine();
                        subject.Advert            = advert;
                        subject.AdvertDescription = "Sprzedam silnki u¿ywany, dwusuwowy.";
                        subject.AdvertName        = "Silnik mercury";
                        subject.Brand             = "Mercury";
                        subject.BuiltYear         = new Random().Next(1970, 2018).ToString();
                        subject.CategoryId        = 3;
                        subject.Power             = new Random().Next(1, 1000);
                        subject.Price             = new Random().Next(2000, 400000);
                        subject.TypeOfEngine      = DomainModel.Engine.EngineType.Outboard;
                        subject.TypeOfFuel        = DomainModel.Engine.FuelType.Gasoline;
                        DomainModel.Image uploadedImg = new DomainModel.Image();
                        int length = new Random().Next(1000, 99999);
                        uploadedImg.ImageData  = new byte[length];
                        uploadedImg.Name       = "silnikMercury";
                        uploadedImg.Identifier = Guid.NewGuid();
                        uploadedImg.Subject    = subject;
                        _db.images.Add(uploadedImg);
                        _db.SaveChanges();
                        break;

                    case 2:
                        DomainModel.Trailor subjectTrailor = new DomainModel.Trailor();
                        subjectTrailor.Advert            = advert;
                        subjectTrailor.AdvertDescription = "Sprzedam przyczepe u¿ywan¹ typu laweta.";
                        subjectTrailor.AdvertName        = "Przyczepa laweta";
                        subjectTrailor.Brand             = "Branderup";
                        subjectTrailor.BuiltYear         = new Random().Next(1970, 2018).ToString();
                        subjectTrailor.CategoryId        = 4;
                        subjectTrailor.Capcity           = new Random().Next(100, 40000);
                        subjectTrailor.Price             = new Random().Next(1500, 20000);
                        subjectTrailor.Length            = new Random().Next(4, 10);
                        subjectTrailor.Weight            = new Random().Next(100, 1000);
                        subjectTrailor.Width             = new Random().Next(1, 3);
                        DomainModel.Image uploadedImgTrailor = new DomainModel.Image();
                        int lengthTrailorImage = new Random().Next(1000, 99999);
                        uploadedImgTrailor.ImageData  = new byte[lengthTrailorImage];
                        uploadedImgTrailor.Name       = "Przyczepa";
                        uploadedImgTrailor.Identifier = Guid.NewGuid();
                        uploadedImgTrailor.Subject    = subjectTrailor;
                        _db.images.Add(uploadedImgTrailor);
                        _db.SaveChanges();
                        break;

                    case 3:
                        Boat     subjectBoat = new Boat();
                        SailBoat sailboat    = new SailBoat();
                        subjectBoat.AdvertDescription = "Sprzedam ¿aglówke, pierwszy w³aœciciel, jednomasztowa";
                        subjectBoat.AdvertName        = "Venuska";
                        subjectBoat.Price             = new Random().Next(1000, 99999);
                        subjectBoat.Advert            = advert;
                        sailboat.EnginePower          = new Random().Next(10, 888);
                        sailboat.EngineType           = 1;
                        sailboat.HullType             = "Kilowa";
                        sailboat.IsEngine             = true;
                        sailboat.RudderType           = "Rumpel";
                        sailboat.SailsArea            = new Random().Next(5, 40);
                        sailboat.YachtType            = "kilowy";
                        sailboat.Boat          = subjectBoat;
                        subjectBoat.CategoryId = 1;
                        subjectBoat.SailBoat   = sailboat;
                        DomainModel.Image uploadedImgSailboat = new DomainModel.Image();
                        int lengthSailboatImage = new Random().Next(1000, 99999);
                        uploadedImgSailboat.ImageData  = new byte[lengthSailboatImage];
                        uploadedImgSailboat.Name       = "£ódŸ ¿aglowa";
                        uploadedImgSailboat.Identifier = Guid.NewGuid();
                        uploadedImgSailboat.Subject    = subjectBoat;
                        _db.images.Add(uploadedImgSailboat);
                        _db.SaveChanges();
                        break;

                    case 4:
                        Boat      subjectMotorBoat = new Boat();
                        MotorBoat motorboat        = new MotorBoat();
                        subjectMotorBoat.AdvertDescription = "Sprzedam ¿aglówke, pierwszy w³aœciciel, jednomasztowa";
                        subjectMotorBoat.AdvertName        = "Venuska";
                        subjectMotorBoat.Price             = new Random().Next(1000, 99999);
                        subjectMotorBoat.Advert            = advert;
                        motorboat.EnginePower       = new Random().Next(10, 888);
                        motorboat.MotorboatType     = 1;
                        motorboat.Boat              = subjectMotorBoat;
                        subjectMotorBoat.CategoryId = 2;
                        subjectMotorBoat.MotorBoat  = motorboat;
                        DomainModel.Image uploadedImgMotorboat = new DomainModel.Image();
                        int lengthMotorboatImage = new Random().Next(1000, 99999);
                        uploadedImgMotorboat.ImageData  = new byte[lengthMotorboatImage];
                        uploadedImgMotorboat.Name       = "£ódŸ motorowdna";
                        uploadedImgMotorboat.Identifier = Guid.NewGuid();
                        uploadedImgMotorboat.Subject    = subjectMotorBoat;
                        _db.images.Add(uploadedImgMotorboat);
                        _db.SaveChanges();
                        break;

                    case 5:
                        Sail sails = new Sail();
                        sails.Advert            = advert;
                        sails.AdvertDescription = "";
                        sails.AdvertName        = "Sprzedam ¿agiel - u¿ywany";
                        sails.Brand             = "NorthSails";
                        sails.CategoryId        = 5;
                        sails.FootLenght        = new Random().Next(1, 3);
                        sails.LeechLenght       = new Random().Next(1, 6);
                        sails.LuffLenght        = new Random().Next(1, 6);
                        sails.Price             = new Random().Next(100, 1200);
                        sails.SailArea          = new Random().Next(2, 20);
                        DomainModel.Image uploadedImgSails = new DomainModel.Image();
                        int lengthSailsImage = new Random().Next(1000, 99999);
                        uploadedImgSails.ImageData  = new byte[lengthSailsImage];
                        uploadedImgSails.Name       = "¯agiel";
                        uploadedImgSails.Identifier = Guid.NewGuid();
                        uploadedImgSails.Subject    = sails;
                        _db.images.Add(uploadedImgSails);
                        _db.SaveChanges();
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                return(BadRequest());
            }



            return(Ok());
        }
        public async Task <IHttpActionResult> UploadImage()
        {
            if (HttpContext.Current.Request.Files.AllKeys.Any())
            {
                string             subjectId   = HttpContext.Current.Request.Form[0];
                string             jsonSubject = HttpContext.Current.Request.Form[1];
                string             jsonAdvert  = HttpContext.Current.Request.Form[2];
                string             jsonProduct = HttpContext.Current.Request.Form[3];
                string             Id          = JsonConvert.DeserializeObject <string>(subjectId);
                var                category    = _db.dicCategories.Where(x => x.Id == Id).FirstOrDefault();
                DomainModel.Advert advert      = new DomainModel.Advert();
                advert = JsonConvert.DeserializeObject <DomainModel.Advert>(jsonAdvert);
                advert.AdditionDate = DateTime.Now;

                dynamic subject = null;
                try
                {
                    switch (category.CategoryId)
                    {
                    case 1:
                        subject = new Boat();
                        SailBoat sailboat = new SailBoat();
                        var      boat     = JsonConvert.DeserializeObject <Boat>(jsonSubject);
                        subject = JsonConvert.DeserializeObject <Boat>(jsonProduct);
                        subject.AdvertDescription = boat.AdvertDescription;
                        subject.AdvertName        = boat.AdvertName;
                        subject.Price             = boat.Price;
                        subject.Advert            = advert;
                        sailboat           = JsonConvert.DeserializeObject <SailBoat>(jsonProduct);
                        subject.SailBoat   = sailboat;
                        subject.CategoryId = category.CategoryId;
                        _db.boats.Add(subject);
                        break;

                    case 2:
                        subject = new Boat();
                        MotorBoat motorBoat = new MotorBoat();
                        var       mBoat     = JsonConvert.DeserializeObject <Boat>(jsonSubject);
                        subject = JsonConvert.DeserializeObject <Boat>(jsonProduct);
                        subject.AdvertDescription = mBoat.AdvertDescription;
                        subject.AdvertName        = mBoat.AdvertName;
                        subject.Price             = mBoat.Price;
                        subject.Advert            = advert;
                        motorBoat          = JsonConvert.DeserializeObject <MotorBoat>(jsonProduct);
                        subject.MotorBoat  = motorBoat;
                        subject.CategoryId = category.CategoryId;
                        break;

                    case 3:
                        subject = new DomainModel.Engine();
                        ApiContract.Subject enginePar          = JsonConvert.DeserializeObject <ApiContract.Subject>(jsonSubject);
                        ApiContract.Engine  subjectApiContract = JsonConvert.DeserializeObject <ApiContract.Engine>(jsonProduct);
                        _mapper.Map <ApiContract.Subject, DomainModel.Engine>(enginePar, subject);
                        _mapper.Map <ApiContract.Engine, DomainModel.Engine>(subjectApiContract, subject);

                        //subject.Price = subjectJsonPar.Price;
                        //subject.BuiltYear = subjectJsonPar.BuiltYear;
                        //subject.Brand = subjectJsonPar.Brand;
                        //subject.Power = subjectJsonPar.Power;
                        //subject.TypeOfEngine = subjectJsonPar.TypeOfEngine;
                        //subject.TypeOfFuel = subjectJsonPar.TypeOfFuel;
                        //subject = enginePar;
                        //subject.Brand = enginePar.Brand;
                        subject.CategoryId = category.CategoryId;
                        subject.Advert     = advert;

                        break;

                    case 4:
                        subject = new Trailor();
                        var trailorParams = JsonConvert.DeserializeObject <Trailor>(jsonSubject);
                        subject            = JsonConvert.DeserializeObject <Trailor>(jsonProduct);
                        subject.CategoryId = category.CategoryId;
                        subject.Advert     = advert;
                        break;

                    case 5:
                        subject = new Sail();
                        var sailParams = JsonConvert.DeserializeObject <Sail>(jsonSubject);
                        subject            = JsonConvert.DeserializeObject <Sail>(jsonProduct);
                        subject.CategoryId = category.CategoryId;
                        subject.Advert     = advert;
                        break;

                    case 6:
                        subject = new Accesory();
                        var accessoryParams = JsonConvert.DeserializeObject <Accesory>(jsonSubject);
                        subject            = JsonConvert.DeserializeObject <Accesory>(jsonProduct);
                        subject.CategoryId = category.CategoryId;
                        subject.Advert     = advert;
                        break;
                    }
                }
                catch (Exception ex)
                {
                    return(BadRequest(ex.Message));
                }
                try
                {
                    foreach (string fileName in HttpContext.Current.Request.Files)
                    {
                        var httpPostedFile = HttpContext.Current.Request.Files[fileName];

                        if (httpPostedFile != null)
                        {
                            DomainModel.Image uploadedImg = new DomainModel.Image();
                            int length = httpPostedFile.ContentLength;
                            uploadedImg.ImageData = new byte[length];
                            httpPostedFile.InputStream.Read(uploadedImg.ImageData, 0, length);
                            uploadedImg.Name       = Path.GetFileName(httpPostedFile.FileName);
                            uploadedImg.Identifier = Guid.NewGuid();
                            uploadedImg.Subject    = subject;
                            _db.images.Add(uploadedImg);
                            var fileSavePath = Path.Combine(HttpContext.Current.Server.MapPath("~/AdvertImages"), httpPostedFile.FileName);
                            httpPostedFile.SaveAs(fileSavePath);
                        }
                    }
                    _db.SaveChanges();

                    return(Ok());
                }
                catch (Exception ex)
                {
                    return(BadRequest(ex.Message));
                }
            }
            return(Ok());
        }
Exemplo n.º 12
0
        public Boat createBoat()
        {
            int    boatLen      = 0;
            int    boatType     = 0;
            int    boatDraft    = 0;
            string strBoatOwner = string.Empty;
            string strBoatName  = string.Empty;


            Boat Boat = null;

            while (true)
            {
                Console.WriteLine("Enter Boat Length");
                string strBoatLength = Console.ReadLine();
                if (!string.IsNullOrEmpty(strBoatLength))
                {
                    int.TryParse(strBoatLength, out boatLen);
                }
                if (boatLen < 1)
                {
                    Console.WriteLine("Boat Length Cannot be less tha 1 meter");
                }
                if (boatLen > marinaLength || boatLen < 1)
                {
                    Console.WriteLine("Boat Length Cannot be Greater than Marina Length or less than 1 meter");
                }
                //else if(boatLen>(Marina.getCurrentCapacityMarinaLength()-Marina.MarinaLength))
                else if (boatLen > (marinaLength - Marina.getCurrentCapacityMarinaLength()))
                {
                    throw new ArgumentException("The current marina capacity of " + Marina.getCurrentCapacityMarinaLength().ToString() + " will not be enough to accomodate this boat");
                }
                else
                {
                    break;
                }
            }
            while (true)
            {
                Console.WriteLine("Enter Boat Draft");
                string strBoatDraft = Console.ReadLine();
                if (!string.IsNullOrEmpty(strBoatDraft))
                {
                    int.TryParse(strBoatDraft, out boatDraft);
                }
                if (boatDraft < 1)
                {
                    Console.WriteLine("Boat Draft Cannot be less tha 1 meter");
                }
                if (boatDraft > 5 || boatDraft < 1)
                {
                    Console.WriteLine("Boat Draft Cannot be Greater than 5 meters or less than 1 meter");
                }
                else
                {
                    break;
                }
            }
            //check reservation here
            bool proceed = calculateBoatResrvation();

            if (proceed)
            {
                while (true)
                {
                    Console.WriteLine("Enter Boat Owner");
                    strBoatOwner = Console.ReadLine();
                    if (!string.IsNullOrEmpty(strBoatOwner))
                    {
                        break;
                    }
                }

                while (true)
                {
                    Console.WriteLine("Enter Boat Name");
                    strBoatName = Console.ReadLine();
                    if (!string.IsNullOrEmpty(strBoatName))
                    {
                        break;
                    }
                }



                Console.WriteLine("Choose Boat Type:");
                while (true)
                {
                    try
                    {
                        boatType = DisplayManager.displayBoatTypesMenu();
                        break;
                    }
                    catch (Exception ex)
                    {
                        DisplayManager.displayMessage(ex.Message);
                    }
                }


                switch (boatType)
                {
                case 1:

                    MotorBoat MB        = (Factory.MotorBoat)BoatFactory.BuildBoat(boatType);
                    int       mbSubtype = BoatFactory.BuildBoatSubTypes(boatType);
                    MB.DriveType = MB.GetEnumNameFromValue(mbSubtype);
                    Boat         = MB;
                    break;

                case 2:

                    // NarrowBoat NB = new NarrowBoat("NarrowBoat", boatType);
                    NarrowBoat NB        = (Factory.NarrowBoat)BoatFactory.BuildBoat(boatType);
                    int        nbSubtype = BoatFactory.BuildBoatSubTypes(boatType);
                    NB.SternType = NB.GetEnumNameFromValue(nbSubtype);
                    Boat         = NB;
                    break;

                case 3:

                    //SailingBoat SB = new SailingBoat("Sailing", boatType);
                    SailingBoat SB        = (Factory.SailingBoat)BoatFactory.BuildBoat(boatType);
                    int         sbSubtype = BoatFactory.BuildBoatSubTypes(boatType);
                    SB.SailingType = SB.GetEnumNameFromValue(sbSubtype);
                    Boat           = SB;
                    break;

                default:
                    break;
                }

                if (Boat != null)
                {
                    Boat.BoatLength  = boatLen;
                    Boat.NameOfBoat  = strBoatName;
                    Boat.NameOfOwner = strBoatOwner;
                    Boat.BoatDraft   = boatDraft;
                    Factory.BoatHelperClass.showDetails(Boat);
                }
            }
            else
            {
                throw new Exception("User terminated Booking transaction");
            }



            return(Boat);
        }