Exemplo n.º 1
0
        public static string test(Garage <Vehicle> garage, int c)
        {
            Car car = new Car();

            car.RegNr       = "123abc";
            car.Colour      = "Blue";
            car.NbrOFSeats  = 5;
            car.FuelType    = "Gasole";
            car.TypOfEngine = "V8";
            car.TypOfModel  = "Combie";
            car.Brand       = "BMW";
            car.WheelDrive  = "Front";

            Airplane aplane = new Airplane();

            aplane.RegNr       = "456def";
            aplane.Colour      = "White";
            aplane.NbrOFSeats  = 65;
            aplane.FuelType    = "Infants";
            aplane.TypOfEngine = "Jet";
            aplane.TypOfModel  = "Private";
            aplane.WingSpan    = 50;

            Tank tank = new Tank();

            tank.RegNr       = "789ghi";
            tank.Colour      = "Olive";
            tank.NbrOFSeats  = 3;
            tank.FuelType    = "Disel";
            tank.TypOfEngine = "Tractor";
            tank.TypOfModel  = "Scout";
            tank.Caliber     = 50;

            garage.AddToArray(car);
            garage.AddToArray(aplane);
            garage.AddToArray(tank);

            return(car.Stats() + aplane.Stats() + tank.Stats());
        }
Exemplo n.º 2
0
        public static string AddAirplane(Garage <Vehicle> garage)
        {
            Airplane aplane = new Airplane();

            Console.WriteLine("What is the Registration Number of the Airplane?");
            Console.Write("> ");
            aplane.RegNr = Console.ReadLine();

            Console.Clear();
            Scene.title();
            Console.WriteLine("What Colour is the airplane?");
            Console.Write("> ");
            aplane.Colour = Console.ReadLine();

            aplane.NbrOFSeats = EnvisInmat();

            Console.Clear();
            Scene.title();
            Console.WriteLine("What fuel does the airplane use?");
            Console.Write("> ");
            aplane.FuelType = Console.ReadLine();

            Console.Clear();
            Scene.title();
            Console.WriteLine("What engine does the airplane have?");
            Console.Write("> ");
            aplane.TypOfEngine = Console.ReadLine();

            Console.Clear();
            Scene.title();
            Console.WriteLine("What model is the airplane?");
            Console.Write("> ");
            aplane.TypOfModel = Console.ReadLine();

            bool y = true;

            while (y)
            {
                try
                {
                    Console.Clear();
                    Scene.title();
                    Console.WriteLine("What is the wingspan?");
                    Console.Write("> ");
                    aplane.WingSpan = int.Parse(Console.ReadLine());
                    y = false;
                }
                catch
                {
                    Console.Clear();
                    Scene.title();
                    Console.WriteLine("Please enter a number");
                    Console.ReadKey();
                    y = true;
                }
            }

            Console.Clear();
            Scene.title();
            Console.WriteLine(aplane.Stats());
            Console.ReadKey();

            garage.AddToArray(aplane);

            return(aplane.Stats());
        }