Created
July 13, 2022 03:56
-
-
Save natafaye/5c6271265bb8f916f7a6b3c2df3a4d19 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Elevator { | |
constructor(capacity) { | |
this.capacity = capacity; | |
this.numPeopleInside = 0; | |
this.nextFloor = 0; | |
} | |
goToNextFloor() { | |
} | |
unload() { | |
} | |
load() { | |
} | |
} | |
class Floor { | |
constructor(people) { | |
this.people = people; | |
} | |
} | |
class Building { | |
constructor(numFloors) { | |
this.elevator = new Elevator(5); | |
this.floors = []; | |
for(let i = 0; i < numFloors; i++) { | |
const randomNumber = Math.floor(Math.random() * 20); | |
const currentFloor = new Floor(randomNumber) | |
this.floors.push(currentFloor) | |
//console.log("On the " + i + " looping, this.floors was", this.floors); | |
} | |
console.log("Inside the constructor"); | |
} | |
start() { | |
this.elevator.goToNextFloor() | |
} | |
} | |
const apartmentBuilding = new Building(6); | |
//console.log(apartmentBuilding) | |
apartmentBuilding.start(); | |
const hospital = new Building(50); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment