Calculate Catch Rate

Fish Catch Rate Calculator

This calculator helps you estimate your fish catch rate based on the number of fish caught and the total fishing time. A higher catch rate generally indicates more successful fishing trips.

function calculateCatchRate() { var fishCaughtInput = document.getElementById("fishCaught"); var fishingHoursInput = document.getElementById("fishingHours"); var resultDiv = document.getElementById("result"); var fishCaught = parseFloat(fishCaughtInput.value); var fishingHours = parseFloat(fishingHoursInput.value); if (isNaN(fishCaught) || isNaN(fishingHours)) { resultDiv.innerHTML = "Please enter valid numbers for both fields."; return; } if (fishingHours <= 0) { resultDiv.innerHTML = "Fishing time must be greater than zero."; return; } var catchRate = fishCaught / fishingHours; resultDiv.innerHTML = "

Your Catch Rate:

" + catchRate.toFixed(2) + " fish per hour"; } .calculator-container { font-family: sans-serif; border: 1px solid #ddd; padding: 20px; border-radius: 8px; max-width: 400px; margin: 20px auto; background-color: #f9f9f9; } .input-section { margin-bottom: 15px; } .input-section label { display: block; margin-bottom: 5px; font-weight: bold; } .input-section input { width: calc(100% – 12px); padding: 8px; border: 1px solid #ccc; border-radius: 4px; } button { background-color: #4CAF50; color: white; padding: 10px 15px; border: none; border-radius: 4px; cursor: pointer; font-size: 16px; margin-top: 10px; } button:hover { background-color: #45a049; } #result { margin-top: 20px; padding: 10px; border: 1px solid #eee; background-color: #fff; border-radius: 4px; } #result h3 { margin-top: 0; color: #333; } #result p { font-size: 1.1em; color: #555; }

Leave a Comment