Crime Rate Calculator

Crime Rate Calculator

This calculator helps estimate the crime rate for a given area. Crime rate is typically expressed as the number of crimes per 100,000 people. This calculation uses reported incidents and population data to provide an annualized rate.

function calculateCrimeRate() { var reportedIncidentsInput = document.getElementById("reportedIncidents"); var populationInput = document.getElementById("population"); var resultDiv = document.getElementById("result"); var reportedIncidents = parseFloat(reportedIncidentsInput.value); var population = parseFloat(populationInput.value); if (isNaN(reportedIncidents) || isNaN(population) || population <= 0) { resultDiv.innerHTML = "Please enter valid numbers for reported incidents and population. Population must be greater than zero."; return; } // Crime Rate Formula: (Number of Reported Incidents / Population) * 100,000 var crimeRate = (reportedIncidents / population) * 100000; resultDiv.innerHTML = "Estimated Crime Rate: " + crimeRate.toFixed(2) + " per 100,000 people."; }

Leave a Comment