Code:
var mtrcycMPG = document.getElementById("mtrcycMpg").value;
var hybridMpg = document.getElementById("hybridMpg").value;
Should Be:
Code:
var mtrcycMPG = document.getElementById("mcmpg").value;
var hybridMpg = document.getElementById("hmpg").value;
Your IDs.
---------------------------------------------------------------------
These are not needed. It's where the answers go.
Code:
var mycar = document.getElementById("mycar").value;
var mtrcyc = document.getElementById("mtrcyc").value;
var hybrid = document.getElementById("hybrid").value;
Your math is wrong. You multiply first than divide. So your missing parentheses (). It's mycar = (dist/mycarMpg)*2.33;
Save some time and use (dist*2.33)/mycarMpg. (dist*2.33) is a constent and can be used in all calculations.
K = 638 * 2.33 = 1,486.54
so mycar = 1,486.54/mycarMpg;same for mtrcyc and hybrid.
And put the lines in to write your output.