summaryrefslogtreecommitdiff
path: root/graphs/js/myCompany/boss.js
diff options
context:
space:
mode:
Diffstat (limited to 'graphs/js/myCompany/boss.js')
-rw-r--r--graphs/js/myCompany/boss.js30
1 files changed, 30 insertions, 0 deletions
diff --git a/graphs/js/myCompany/boss.js b/graphs/js/myCompany/boss.js
new file mode 100644
index 0000000..eadf09c
--- /dev/null
+++ b/graphs/js/myCompany/boss.js
@@ -0,0 +1,30 @@
+const { Employee } = require("./employee");
+
+class Boss extends Employee {
+ constructor(name, accreditationLevel) {
+ super(name);
+ this.accreditationLevel = accreditationLevel;
+ }
+ getAccreditation() {
+ return this.accreditationLevel;
+ }
+ fire(target) {
+ if (!(target instanceof Employee)) {
+ console.log("I cannot fire that!");
+ return false;
+ } else if (
+ !(target instanceof Boss) ||
+ target.getAccreditation() < this.accreditationLevel
+ ) {
+ console.log(target.getName() + " you are fired!");
+ return true;
+ } else {
+ console.log("I cannot fire someone superior to me!");
+ return false;
+ }
+ }
+}
+
+module.exports = {
+ Boss,
+};