Basic Salary Of An Employee As Input And Calculate The Net Payment To Any Employee.

0

A company has following payment scheme for their staff:

a. Net Salary = Gross Salary – Deduction
b. Gross Salary = Basic pay + DA + HRA + Medical
c. Deduction = Insurance + PF
Where,
  • DA (Dearness Allowance) = 50% of Basic pay
  • HRA (House Rent Allowance) = 10% of Basic pay
  • Medical = 4% of Basic pay
  • Insurance = 7% of Gross salary
  • PF (Provident Fund) = 5% of Gross salary
Write a script to take the basic salary of an employee as input and calculate the net payment to any employee.


A company has following payment scheme for their staff: a. Net Salary = Gross Salary – Deduction b. Gross Salary = Basic pay + DA + HRA + Medical c. Deduction = Insurance + PF Where, DA (Dearness Allowance) = 50% of Basic pay HRA (House Rent Allowance) = 10% of Basic pay Medical = 4% of Basic pay Insurance = 7% of Gross salary PF (Provident Fund) = 5% of Gross salary Write a script to take the basic salary of an employee as input and calculate the net payment to any employee.


PROGRAM
<html>
<head>
    <title>Employee Salary Calculator</title>
</head>
<body>

    <?php
        $basic_pay = $_POST['basic_pay'];
        $da = $basic_pay * 0.5;
        $hra = $basic_pay * 0.1;
        $medical = $basic_pay * 0.04;
        $gross_salary = $basic_pay + $da + $hra + $medical;
        $insurance = $gross_salary * 0.07;
        $pf = $gross_salary * 0.05;
        $deduction = $insurance + $pf;
        $net_salary = $gross_salary - $deduction;
    ?>

    <form method="post">
        <label for="basic_pay">Enter Basic Pay:</label>
        <input type="number" name="basic_pay" id="basic_pay" value="<?php echo $basic_pay; ? >">
        <input type="submit" value="Calculate">
    </form>

    <?php
        if (isset($basic_pay)) {
            echo "<p>Gross Salary: $gross_salary</p>";
            echo "<p>Insurance: $insurance</p>";
            echo "<p>PF: $pf</p>";
            echo "<p>Deduction: $deduction</p>";
            echo "<p>Net Salary: $net_salary</p>";
        }
    ?>

</body>
</html>

OUTPUT
*If image are looking blur then click on the image for HD quality.
A company has following payment scheme for their staff: a. Net Salary = Gross Salary – Deduction b. Gross Salary = Basic pay + DA + HRA + Medical c. Deduction = Insurance + PF Where, DA (Dearness Allowance) = 50% of Basic pay HRA (House Rent Allowance) = 10% of Basic pay Medical = 4% of Basic pay Insurance = 7% of Gross salary PF (Provident Fund) = 5% of Gross salary Write a script to take the basic salary of an employee as input and calculate the net payment to any employee.

Explanation
This script takes in the basic pay of an employee through a form and calculates their net salary based on the given payment scheme. The calculated values for DA, HRA, Medical, Gross Salary, Insurance, PF, Deduction, and Net Salary are displayed on the page.

❤️ I Hope This Helps You Understand, Click Here To Do More Exercise In PHP Programming.


Post a Comment

0Comments
Post a Comment (0)