-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
52 lines (47 loc) · 1.07 KB
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
class Employee{
constructor(name,age,salary) {
this.name = name;
this.age = age;
this.salary = salary;
}
getName(){
return this.name
}
getAge(){
return this.age
}
getSalary(){
return this.salary
}
setName(name) {
this.name = name;
}
setAge(age) {
this.age = age;
}
setSalary(salary) {
this.salary = salary;
}
}
let a = new Employee ("Tunzala","20","1000")
console.log(`${a.getName()} has ${a.getAge()} and gets ${a.getSalary()} from company`)
class Programmer extends Employee{
constructor(name,age,salary,lang){
super(name, age, salary)
this.lang=lang;
}
getLanguage(){
return this.lang
}
setLanguage(lang) {
this.lang = lang;
}
getMultipliedSalary(){
return super.getSalary()*3
}
}
let b = new Programmer ("Tunzala",20,1000,"JavaScript")
console.log(`${b.getName()} learns ${b.getLanguage()} and earns ${b.getMultipliedSalary()} `)
let i = new Programmer ("Alex", 34, 2000, "C++, Python" )
console.log(i)
console.log(i.getMultipliedSalary())