Apr 2, 2021

Java program to calculate net salary of an employee using TA,DA and HRA

 Ex: Write a java program to calculate net salary of an employee using TA,DA and HRA. How to write a java program to calculate net salary of an employee using TA,DA and HRA. Java program to calculate net salary of an employee using TA,DA and HRA.  

Basic   salary   of an  employee using following TA, DA and HRA. The   TA & DA is   40%   of   the   basic   salary   while   the   HRA   is   60%   of   the   basic salary and Net salary is addition of TA, DA and HRA.


Program:

import java.util.Scanner;

public class NetSalary {


    public static void main(String args[]) {

        Scanner sc = new Scanner(System.in);

        float b;
        float ta;
        float da;
        float hra;
        float net;

        System.out.println("Enter the basic salary of an employee:");
        b = sc.nextInt();

        ta = (b * 40) / 100;
        da = (b * 40) / 100;
        hra = (b * 60) / 100;

        net = ta + da + hra;

        System.out.println("Net salary of an employee is: " +net);

    }
}
Above java program shows the following output:

Enter the basic salary of an employee:  15000

Net salary of an employee is: 21000.0

Share This:    Facebook Twitter

0 comments:

Post a Comment

If you have any doubts, please discuss here...