Widget:YieldCalc: Difference between revisions
No edit summary |
No edit summary |
||
Line 11: | Line 11: | ||
<form id="foodYieldForm"> | <form id="foodYieldForm"> | ||
<input type="number" id="cityProd" placeholder="62"><br /> | <input type="number" id="cityProd" placeholder="62"><br /> | ||
<input type="submit" value="Calculate" onClick=" | <input type="submit" value="Calculate" onClick="calcscipt()"/> | ||
</form> | </form> | ||
<script type="text/javascript"> | <script type="text/javascript"> | ||
/* Yield Calculator */ | /* Yield Calculator */ | ||
function | function calcscipt(){ | ||
let a = document.getElementById("cityProd"); /* City Production */ | let a = document.getElementById("cityProd").value; /* City Production */ | ||
let b = 4; /* Yield(Apples) of the region */ | let b = 4; /* Yield(Apples) of the region */ | ||
let c = 3; /* Amount of Farms in the region */ | let c = 3; /* Amount of Farms in the region */ | ||
Line 32: | Line 29: | ||
let z = Math.floor(a*b+b*5*h+5+(a+5*h)*(e/100)+(h-1)*5+a); /* Food yield for a single farm in the region */ | let z = Math.floor(a*b+b*5*h+5+(a+5*h)*(e/100)+(h-1)*5+a); /* Food yield for a single farm in the region */ | ||
alert("z"); | |||
} | |||
</script> | </script> | ||
</includeonly> | </includeonly> |
Revision as of 22:30, 24 October 2024
This widget is used to display and calculate the yield with the values submitted by the user.
Usage: {{#Widget:YieldCalc}}