Coders Packet

Salary calculation using Java

By TANUJA.D

This is a java implementation packet that calculates and displays the Gross and Net Salary of the employee. It is developed using NetBeans IDE.

GROSS SALARY:

It is the amount received by the employee after totaling all the allowances and benefits without any tax deductions.

NET SALARY:

Net salary is the amount that an employee receives after all tax deductions have been taken out.

To achieve this, two formulas are to be known.

1. Gross Salary = Basic Salary + Dearness Allowance + House Rent Allowance

2. Net Salary= Gross Salary - Income Tax - Professional Tax - Provident Fund

The Basic Salary, Dearness Allowance, House Rent Allowance, Income Tax, Professional Tax, and Provident Fund are obtained from the user.

import java.util.Scanner;

public class GrossNetSalary {
public static void main(String[] args) {
float basic_salary_emp,DearnessAllowance,HouseRentAllowance,DearnessAllowance_final,HouseRentAllowance_final,GrossSalary;
double Income_Tax,Professional_Tax,Provident_Fund,NetSalary;

Scanner s=new Scanner(System.in);

System.out.println("Enter Basic Salary Of The Employee: ");
basic_salary_emp=s.nextFloat();

System.out.println("Enter Basic Dearness Allowance Of The Employee: "); 
DearnessAllowance_final=s.nextFloat();
 
System.out.println("Enter Basic House Rent Allowance Of The Employee: ");
HouseRentAllowance_final=s.nextFloat();
System.out.println("Enter Income Tax % Of The Employee: ");
Income_Tax=s.nextDouble();
System.out.println("Enter Professional Tax % Of The Employee: ");
Professional_Tax=s.nextDouble();
System.out.println("Enter Provident Fund % Of The Employee: ");
Provident_Fund=s.nextDouble();

DearnessAllowance = (DearnessAllowance_final * basic_salary_emp) / 100;
HouseRentAllowance = (HouseRentAllowance_final * basic_salary_emp) / 100;
GrossSalary = basic_salary_emp + DearnessAllowance + HouseRentAllowance;
       
Provident_Fund=Provident_Fund*(GrossSalary/100);
Income_Tax=Income_Tax*(GrossSalary/100);
Professional_Tax=Professional_Tax*(GrossSalary/100);
NetSalary=GrossSalary-Income_Tax-Professional_Tax-Provident_Fund;
System.out.println("Gross salary is: "+GrossSalary);
System.out.println("Net Salary is: "+NetSalary);
  }
}    

SAMPLE OUTPUT:

Salary Calculation

Download project

Reviews Report

Submitted by TANUJA.D (Tanuja)

Download packets of source code on Coders Packet