Created
November 12, 2017 11:14
-
-
Save TommyZG/9947e126491226d7759133f35159a5d2 to your computer and use it in GitHub Desktop.
This file contains 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 HospitalEmployee { | |
constructor(name) { | |
this._name = name; | |
this._remainingVacationDays = 20; | |
} | |
static generatePassword(){ | |
return Math.floor(Math.random()*10000); | |
} | |
get name() { | |
return this._name; | |
} | |
get remainingVacationDays() { | |
return this._remainingVacationDays; | |
} | |
takeVacationDays(daysOff) { | |
this._remainingVacationDays -= daysOff; | |
} | |
} | |
class Nurse extends HospitalEmployee { | |
constructor(name, certifications) { | |
super(name); | |
this._certifications = certifications; | |
} | |
get certifications() { | |
return this._certifications; | |
} | |
addCertification(newCertification) { | |
this.certifications.push(newCertification); | |
} | |
} | |
const nurseOlynyk = new Nurse('Olynyk', ['Trauma','Pediatrics']); | |
nurseOlynyk.takeVacationDays(5); | |
console.log(nurseOlynyk.remainingVacationDays); | |
nurseOlynyk.addCertification('Genetics'); | |
console.log(nurseOlynyk.certifications); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment