Пример #1
0
        public Car()
        {
            Make             = "Porsche";
            Model            = "Boxster";
            Color            = "Silver";
            Engine           = new Motor(10);
            Odometer         = new Odometer(0);
            FuelTank         = new FuelTank();
            MaximumOccupancy = new Seat[2];

            // Fill the car with passengers
            for (int i = 0; i < MaximumOccupancy.Length; i++)
            {
                MaximumOccupancy[i] = new Seat(true);
            }
        }
Пример #2
0
        public Car(string make, string model, string color, int maxOccupancy, int currentOccupancy, double fuelEfficiency, double fuelTankCapacity, double fuelLevel, int odometer)
        {
            Make             = make;
            Model            = model;
            Color            = color;
            MaximumOccupancy = new Seat[maxOccupancy];
            Engine           = new Motor(fuelEfficiency);
            Odometer         = new Odometer(odometer);
            FuelTank         = new FuelTank(fuelTankCapacity, fuelLevel);

            // Fill the car with passengers
            for (int i = 0; i < maxOccupancy; i++)
            {
                if (i < currentOccupancy)
                {
                    MaximumOccupancy[i] = new Seat(true);
                }
                else
                {
                    MaximumOccupancy[i] = new Seat();
                }
            }
        }