I am getting multiple user inputs stored in a object, called inputObj, these properties then need to all be ranked out of 100, (attached is the current method for ranking one property), need to do this for up to 20 properties, so currently this is a method where im repeating myself alot.
The maths is all working fine and im gettign the wanted outputs, but need a tidier way to do this, suggestions?
The main issue is that the mathematical manipulations will change for each property, so a universal function applying to all the properties wont work
Thanks
if (inputObj.dyAGE <=5) {
inputObj.dyAGE *= 5.5;
}
else if (inputObj.dyAGE<=7) {
inputObj.dyAGE -= 5;
inputObj.dyAGE *= 16.5;
inputObj.dyAGE += 33;
}
else if(inputObj.dyAGE<=11) {
inputObj.dyAGE -= 7;
inputObj.dyAGE *= 8.25;
inputObj.dyAGE += 66;
}
else if (inputObj.dyAGE<=16) {
inputObj.dyAGE -= 17;
inputObj.dyAGE = -inputObj.dyAGE;
inputObj.dyAGE *= 6.6;
inputObj.dyAGE += 66;
}
else if(inputObj.dyAGE <= 19) {
inputObj.dyAGE -= 20;
inputObj.dyAGE = -inputObj.dyAGE;
inputObj.dyAGE *= 11;
inputObj.dyAGE += 33
}
else if (inputObj.dyAGE <= 30) {
inputObj.dyAGE-31;
inputObj.dyAGE = -inputObj.dyAGE;
inputObj.dyAGE *= 3;
};
ifbody?