Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
1.4 kB
1
Indexable
Never
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Southern Railways Incentive Calculator</title>
</head>
<body>
    <h1>Southern Railways Incentive Calculator</h1>
    <form id="incentiveForm">
        <label for="basicPay">Basic Pay (BP):</label>
        <input type="number" id="basicPay" name="basicPay" required>
        <button type="button" onclick="calculate_GP()">Calculate</button>
    </form>
    <p id="result"></p>

    <script>
        function calculate_GP() {
            // Get the Basic Pay from the input field
            const basicPay = document.getElementById('basicPay').value;

            // Calculate DA and HRA
            const da = basicPay * 0.08;
            const hra = basicPay * 0.05;

            // Calculate GP
            const gp = basicPay + da + hra;

            // Calculate Incentive
            let incentive = 0;
            if (gp <= 15000) {
                incentive = gp * 0.10;
            } else {
                incentive = "No incentive if GP > 15000";
            }

            // Display the results
            document.getElementById('result').innerHTML = `Gross pay: ${gp.toFixed(2)}<br>Incentive: ${incentive.toFixed(2)}`;
        }
    </script>
</body>
</html>
Leave a Comment