One pallet is 500 sq ft, so the total amount needs to be divided by 500. The 5% is the loss percentage, so if someone has 10,000 sq feet, they would need 21 pallets rather than the 20 without the 5%.
The formula is rather basic, and is as follows:
(example)
width x height + 5% / 500
I have it working until I try adding the 5% part, and I tried using 0.05 instead, but no luck.
Below is the code without the percentage, I tried a bunch of scenarios with the percentage, but as I mentioned, no luck.
Thanks in advance:
Code: Select all
function calcRect() {
if(validNumber(document.getElementById('length'), 'length') == true) {
if(validNumber(document.getElementById('width'), 'width') == true) {
var length = (document.getElementById('length').value)
var width = (document.getElementById('width').value)
var prodRect = length * width / 500
document.getElementById('ansRect').value = prodRect
}