Please help me with this broken code ASAP Im getting tired of it : Get all funct
ID: 3577623 • Letter: P
Question
Please help me with this broken code ASAP Im getting tired of it :
Get all functions to work, similar to the customer GUI code we received. Save as YourFirstNameYourLastNameMIS3023Final.html and email to Professor by 11:25 am Hover mouse over the two textareas and the Delete Email field to see what is required on each one New Employee information 10 points E-Ma nedoalhosani@gmail.com Name www Address: wee33 Salary: 2323 Add New Display All Existing Employees 5 points Display Employees Emp Bill Delete An Employee 10 pointsExplanation / Answer
Hello,
Here goes the implementation for 3 methods as requested
Code:
function initEmps(){
alert("In init Emps")
//add dummy employees to array, after asking user for initial size
var emps_array = [];
//emps_array[0][1]="Bill";//this line needs to be commented out
return emps_array;
}
function printEmps(emps_par){
//alert("in printEmps");
var printStr="";
for(var i=0;i<emps_par.length;i++)
printStr = printStr+"Emp: " + emps_par[i][1]+" ";
//REplace this line with other code
//set printStr = all the employees info so it prints out all employees
$("all_emp").value = printStr;
return;
}
function addEmp(emps_par){
//alert ("in add emp");
//add an employee in an empty slot, or if all slots are full, then at the end of the array
var entry=[$("email").value,$("name1").value,$("address").value, $("salary").value];
emps_par.push(entry);
printEmps(emps_par);
return emps_par;
}
function searchEmp(emps_par){
//alert ("in search emp");
//search the array for email, if found, print that employee's details in the emp_found text area,
//otherwise
//alert that employee was not found and clear the search field
//print out the employee if found, otherwise say not found in text area
var searchKey=$("emailToSearch").value;
for(var i=0;i<emps_par.length;i++){
if(emps_par[i][0]==searchKey){
$("emp_found").value=emps_par[i][0]+" "+emps_par[i][1]
return;
}
}
$("emp_found").value="Not Found";
}
Explanation:
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.