Пример #1
0
 public CarSystem(int maximum_speed)
 {
     Contract.Requires(maximum_speed > 0);
     ignition      = new Ignition();
     oilmonitor    = new OilMonitor();
     pedals        = new Pedals();
     petrolmonitor = new PetrolMonitor();
     controller    = new Controller(ignition, oilmonitor, pedals, petrolmonitor, maximum_speed);
 }
Пример #2
0
        // The constructor that the car system calls, It passes on the maximum speed value to the engine interface which passes it on to the SpeedMonitor
        public Controller(Ignition ignition, OilMonitor oilmonitor, Pedals pedals, PetrolMonitor petrolmonitor, int maximum_speed)
        {
            // sees -> insure the parameters are not null
            Contract.Requires(ignition != null);
            Contract.Requires(oilmonitor != null);
            Contract.Requires(pedals != null);
            Contract.Requires(petrolmonitor != null);

            this.ignition      = ignition;
            this.oilmonitor    = oilmonitor;
            this.pedals        = pedals;
            this.petrolmonitor = petrolmonitor;
            // Imports
            brakeinterface  = new BrakeInterface();
            engineinterface = new EngineInterface(maximum_speed);
            dashboard       = new Dashboard();
        }