Question 2 )
class Employee {
constructor(name, address, salary, jobTitle, hike) {
this.name = name;
this.address = address;
this.salary = salary;
this.JT = jobTitle;
this.hike = hike;
}
values() {
return 'Employee Name: ' + this.name + '\n' + 'Employee Address: ' + this.address + '\n' + 'Employee Salary: ' + this.salary +'\n' + 'Employee Role: ' + this.JT;
}
bonus() {
var total = this.salary * this.hike + this.salary;
return 'Salary After Hike: ' + total;
}
}
class Manager extends Employee {
constructor(name, address, salary, jobTitle, hike, department) {
super(name, address, salary, jobTitle, hike);
this.dept = department;
}
managerDetail() {
return super.values() + '\n' + 'Employee Department: ' + this.dept + '\n' + super.bonus();
}
}
class Developer extends Employee {
constructor(name, address, salary, jobTitle, hike, programmingLanguage) {
super(name, address, salary, jobTitle, hike);
this.pl = programmingLanguage;
}
developerDetails() {
return super.values() + '\n' + 'Employee Known Tech Skills: ' + this.pl + '\n' + super.bonus();
}
}
class Programmer extends Employee {
constructor(name, address, salary, jobTitle, hike, project) {
super(name, address, salary, jobTitle, hike);
this.project = project;
}
programmerDetails() {
return super.values() + '\n' + 'Employee Current Project: ' + this.project + '\n' + super.bonus();
}
}
var e1 = new Manager('Tom', 'US', 40000, 'Manager', 0.3, 'HR');
console.log(e1.managerDetail());
var e2 = new Developer('Jhon', 'UK', 55000, 'Back End Developer', 0.4, 'PHP');
console.log(e2.developerDetails());
var e3 = new Programmer('Krish','Canada',50000,'Programmer',0.35,'C++,JS');
console.log(e3.programmerDetails());