Skip to content

Instantly share code, notes, and snippets.

@jx13xx
Last active June 23, 2024 11:44
Show Gist options
  • Save jx13xx/ba93c888f7da37bd0ba325433b7f70a4 to your computer and use it in GitHub Desktop.
Save jx13xx/ba93c888f7da37bd0ba325433b7f70a4 to your computer and use it in GitHub Desktop.
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
}
}
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