((0.9*clf*mot)/100)+(exp/8) = eficienta
Ceea ce doresc eu este sa dau o valoare acestei formule, pentru care se va calcula clf, mot respectiv exp. Mentionez ca am rezolvat aceasta ecuatie pentru a afla formulele in functie de eficienta pentru cele 3 variabile, dar se folosesc de restul necunoscutelor si nu rezolv nimic.
Codul in care folosesc formula:
Cod: Selectaţi tot
var LXSGUS = {};
LXSGUS.INIT = function()
{
this.object = null;
}
LXSGUS.INIT.prototype.setReferenceTo = function(objectId)
{
this.object = document.getElementById(objectId);
}
LXSGUS.INIT.prototype.getReference = function()
{
return this.object;
}
LXSGUS.INIT.prototype.getRows = function(type)
{
// len for length, obj for object;
var object = this.object;
if (type == "len")
{
return object.rows.length;
}
else if (type == "obj")
{
return object.rows;
}
}
LXSGUS.STAFF = function()
{
// Influence factors;
this.skill = 0;
this.motivation = 0;
this.experience = 0;
this.efficiency = 0;
this.training = 0;
this.coefficient = 0;
this.coefficients = {"coach": ["coach",150], "other": ["other",80]};
}
LXSGUS.STAFF.prototype.add = function(what, value)
{
switch(what)
{
case "skill":
this.skill = value;
break;
case "motivation":
this.motivation = value;
break;
case "experience":
this.experience = value;
break;
case "efficiency":
this.efficiency = value;
break;
case "training":
this.training = value;
break;
}
}
LXSGUS.STAFF.prototype.efficience = function()
{
this.efficiency = ((0.9*this.skill*this.motivation)/100)+(this.experience/8);
return this.efficiency;
}
LXSGUS.STAFF.prototype.train = function()
{
this.training = this.coefficient*this.skill*this.skill;
return this.training;
}
LXSGUS.EVENT = function()
{
this.target = null;
}
LXSGUS.EVENT.prototype.getTarget = function(){}
window.onload = function()
{
var _INIT = new LXSGUS.INIT;
var _STAFF = new LXSGUS.STAFF;
_INIT.setReferenceTo('cdata');
var table = _INIT.getReference();
var tableRowLen = _INIT.getRows("len");
var i, j;
for (i=1; i<=tableRowLen; i++)
{
(table.rows[i]).onkeyup = function()
{
this.cells[7].getElementsByTagName('input')[0].style.fontWeight="bold";
this.cells[7].getElementsByTagName('input')[0].value = _STAFF.efficience();
if(this.cells[1].innerHTML.toLowerCase() == _STAFF.coefficients.coach[0]){_STAFF.coefficient = _STAFF.coefficients.coach[1];}else{_STAFF.coefficient = _STAFF.coefficients.other[1];}
this.cells[8].getElementsByTagName('input')[0].style.fontWeight="bold";
this.cells[8].getElementsByTagName('input')[0].value = _STAFF.train();
}
for (j=2; j<=8; j++)
{
(table.rows[i].cells[j]).getElementsByTagName('input')[0].onfocus = function()
{
this.readOnly = false;
this.select();
this.onkeyup = function()
{
if (this.getAttribute('id') == 'skl'){_STAFF.add("skill", this.value);}
else if (this.getAttribute('id') == 'mot'){_STAFF.add("motivation", this.value);}
else if (this.getAttribute('id') == 'exp'){_STAFF.add("experience", this.value);}
else{ /*table.rows[1].cells[7].innerHTML = target.value;*/ }
}
this.onfocus = function()
{
if (this.getAttribute('id') == 'skl'){_STAFF.add("skill", this.value);}
else if (this.getAttribute('id') == 'mot'){_STAFF.add("motivation", this.value);}
else if (this.getAttribute('id') == 'exp'){_STAFF.add("experience", this.value);}
else{ /*table.rows[1].cells[7].innerHTML = target.value;*/ }
}
}
}
}
}
