diff --git a/starter_code/elevator.js b/starter_code/elevator.js index 5339f35..1b7c158 100644 --- a/starter_code/elevator.js +++ b/starter_code/elevator.js @@ -1,19 +1,37 @@ -class Elevator { +class Elevator{ constructor(){ this.floor = 0; this.MAXFLOOR = 10; this.requests = []; } - start() { } - stop() { } - update() { } + start(){ + var interval = setInterval(this.update(),1000); + } + stop(){ + clearInterval(interval); + } + update(){ + this.log(); + } _passengersEnter() { } _passengersLeave() { } - floorUp() { } - floorDown() { } - call() { } - log() { } + floorUp(){ + if(this.floor < this.MAXFLOOR){ + this.floor += 1; + } + } + floorDown(){ + if(this.floor > 0){ + this.floor -= 1; + } + } + call(){ + + } + log(){ + console.log("Direction: " + this.requests + " | Floor: " + this.floor); + } } module.exports = Elevator;