I’m trying out some new found coding skills and still have a lot of room to go so I know this function maybe a tad crude, but I’m having trouble with getting a correct ‘total’. The function takes any of four inputs values and multiplies them according to different values of ‘select/options’ and calculates a ‘total’. No matter the input value or the value of the ‘select’ option, my total comes up to ‘0’. Anyone tell me what I did wrong?
function submitAll() {
switch (fOne) {
case 'weekly':
cOne *= 4;
break;
case 'biweekly':
cOne *= 2;
}
switch (fTwo) {
case 'weekly':
cTwo *= 4;
break;
case 'biweekly':
cTwo *= 2;
}
switch (fThree) {
case 'weekly':
cThree *= 4;
break;
case 'biweekly':
cThree *= 2;
}
switch (fFour) {
case 'weekly':
cFour *= 4;
break;
case 'biweekly':
cFour *= 2;
}
total = cOne + cTwo + cThree + cFour;
document.getElementById("display").innerHTML = 'Your total income is; ' + total;
}