function calculateWearTear() { const tenancyLength = parseFloat(document.getElementById('tenancyLength').value); const occupants = parseInt(document.getElementById('occupants').value); const itemAge = parseFloat(document.getElementById('itemAge').value); const condition = document.getElementById('condition').value; if (!tenancyLength || !occupants || !itemAge || !condition) { document.getElementById('result').innerHTML = "Please fill out all fields."; return; } let wearFactor = 0; // Assigning wear factor based on condition if (condition === "good") { wearFactor = 1; } if (condition === "average") { wearFactor = 1.5; } if (condition === "poor") { wearFactor = 2; } // Calculate Wear & Tear Score const wearAndTearScore = Math.min(100, (tenancyLength * wearFactor * occupants) / (itemAge + 1) * 10); let recommendation = ""; // Recommendations based on wear & tear score if (wearAndTearScore < 25) { recommendation = "Minimal wear and tear. Item in good condition."; } else if (wearAndTearScore < 50) { recommendation = "Moderate wear and tear. Consider light repairs."; } else if (wearAndTearScore < 75) { recommendation = "Significant wear and tear. Replacement may be necessary."; } else { recommendation = "Severe wear and tear. Replacement is highly recommended."; } document.getElementById('result').innerHTML = ` Wear & Tear Score: ${Math.round(wearAndTearScore)}%
${recommendation} `; } Call Now Button