Skip to content

Instantly share code, notes, and snippets.

@natafaye
Created July 13, 2022 03:56
Show Gist options
  • Save natafaye/5c6271265bb8f916f7a6b3c2df3a4d19 to your computer and use it in GitHub Desktop.
Save natafaye/5c6271265bb8f916f7a6b3c2df3a4d19 to your computer and use it in GitHub Desktop.
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