This calculator helps you determine your holiday pay rate based on your regular earnings and the number of holiday hours worked.
function calculateHolidayPay() {
var regularHours = parseFloat(document.getElementById("regularHours").value);
var holidayHours = parseFloat(document.getElementById("holidayHours").value);
var regularPayRate = parseFloat(document.getElementById("regularPayRate").value);
var resultDiv = document.getElementById("result");
resultDiv.innerHTML = ""; // Clear previous results
if (isNaN(regularHours) || isNaN(holidayHours) || isNaN(regularPayRate) ||
regularHours < 0 || holidayHours < 0 || regularPayRate < 0) {
resultDiv.innerHTML = "Please enter valid positive numbers for all fields.";
return;
}
var regularPay = regularHours * regularPayRate;
var holidayPay = holidayHours * regularPayRate; // Assuming holiday pay is at the regular rate for simplicity, adjust if different premium applies
var totalPay = regularPay + holidayPay;
var holidayPayRateResult = regularPayRate; // For this simple calculator, the holiday rate IS the regular rate.
resultDiv.innerHTML = "