Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

solve the Feedback of Lab 07 #3

Merged
merged 1 commit into from
Jan 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 38 additions & 39 deletions app.js
Original file line number Diff line number Diff line change
@@ -1,50 +1,49 @@
let Employee = [{
employeeId: employeeId,
firstName: firstName,
lastName: lastName,
department: {
Administration: Administration,
Marketing: Marketing,
Development: Development,
Finance: Finance,
},

level: {
Junior: Junior,
MidSenior: MidSenior,
Senior: Senior
},

imageUrl: imageUrl
}]

function Employee(employeeId, firstName, lastName, department, level, imageUrl) {
this.employeeId = employeeId;
this.firstName = firstName;
this.lastName = lastName;
function Employee(employeeID, fullName, department, level, imageURL) {

this.employeeID = employeeID;
this.fullName = fullName;
this.department = department;
this.level = level;
this.imageUrl = imageUrl;

this.imageURL = imageURL;
this.salary = function () {
let salaryRange;
switch (this.level) {
case 'Senior':
salaryRange = { min: 1500, max: 2000 };
break;
case 'Mid-Senior':
salaryRange = { min: 1000, max: 1500 };
break;
case 'Junior':
salaryRange = { min: 500, max: 1000 };
break;
default:

salaryRange = { min: 500, max: 500 };
}


let randomSalary = Math.floor(Math.random() * (salaryRange.max - salaryRange.min + 1)) + salaryRange.min;

let netSalary = randomSalary - (randomSalary * 0.075);

return netSalary;
}

console.log(this.fullName,this.salary())
document.write(`${this.fullName} - the Salary : (${this.salary()}) ------------- `);

let e1 = new Employee(1000, Ghazi Samer, Administration, Senior)
};



Employee.prototype.getFullName = function () {
return `${this.firstName} ${this.lastName}`;
};
let employee1 = new Employee(1000, 'Ghazi Samer', 'Administration', 'Senior');
let employee2 = new Employee(1001, 'Lana Ali', 'Finance', 'Senior');
let employee3 = new Employee(1002, 'Tamara Ayoub', 'Marketing', 'Senior');
let employee4 = new Employee(1003, 'Safi Walid', 'Administration', 'Mid-Senior');
let employee5 = new Employee(1004, 'Omar Zaid', 'Development', 'Senior');
let employee6 = new Employee(1005, 'Rana Saleh', 'Development', 'Junior');
let employee7 = new Employee(1006, 'Hadi Ahmad', 'Finance', 'Mid-Senior');



for (emp of Employee) {
let content = `<tr>
<td>$(em.employeeId)</td>
<td></td>
<td></td>
</tr>
`
document.getElementById("Employee").innerHTML += content
}