Last active
June 23, 2024 11:44
-
-
Save jx13xx/ba93c888f7da37bd0ba325433b7f70a4 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 Employee { | |
constructor(name, daysWorked) { | |
this.name = name; | |
this.daysWorked = daysWorked; | |
} | |
calculatePay() { | |
const dailyPay = 100; // let's assume daily pay is 100 | |
return this.daysWorked * dailyPay; | |
} | |
calculateLeave() { | |
const totalWorkingDays = 30; // let's assume a month has 30 working days | |
return totalWorkingDays - this.daysWorked; | |
} | |
save() { | |
// Code to save employee data to a database | |
} | |
} |
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 Employee { | |
constructor(name, daysWorked) { | |
this.name = name; | |
this.daysWorked = daysWorked; | |
} | |
calculatePay() { | |
const dailyPay = 100; // let's assume daily pay is 100 | |
return this.daysWorked * dailyPay; | |
} | |
calculateLeave() { | |
const totalWorkingDays = 30; // let's assume a month has 30 working days | |
return totalWorkingDays - this.daysWorked; | |
} | |
} | |
class EmployeeDatabase { | |
constructor(employee) { | |
this.employee = employee; | |
} | |
save() { | |
// Code to save employee data to a database | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment