The unemployment rate is a key economic indicator that measures the percentage of the labor force that is jobless and actively seeking employment. It's calculated using data from labor surveys.
function calculateUnemploymentRate() {
var totalLaborForceInput = document.getElementById("totalLaborForce");
var employedCountInput = document.getElementById("employedCount");
var resultDiv = document.getElementById("result");
var totalLaborForce = parseFloat(totalLaborForceInput.value);
var employedCount = parseFloat(employedCountInput.value);
if (isNaN(totalLaborForce) || isNaN(employedCount)) {
resultDiv.innerHTML = "Please enter valid numbers for both fields.";
return;
}
if (totalLaborForce <= 0) {
resultDiv.innerHTML = "Total labor force must be greater than zero.";
return;
}
if (employedCount totalLaborForce) {
resultDiv.innerHTML = "Number of employed persons cannot be greater than the total labor force.";
return;
}
var unemployedCount = totalLaborForce – employedCount;
var unemploymentRate = (unemployedCount / totalLaborForce) * 100;
resultDiv.innerHTML = "