
Assume 30 days in a month.
Tax Rate for contractors is 10%
For Salaried employees:
a. DA - 75% of Basic salary.
b. HRA - 20% of Basic Salary
c. Medical - 1250 per month.
d. HRA and Medical is Tax Exempt.
e. Tax Rates are (which are to be applied marginally to each bracket):
The candidate should write Java code, so as to: 1. Compute Gross Monthly Salary for all employees
Calculate Tax
Calculate Net Monthly Salary
Store back this data in the correct place

The given code calculates the employees gross monthly salary, tax, net monthly salary.
import java.util.*;
import java.text.*;
class CalculateSalary
{
public static void main(String[] args){
Scanner input=new Scanner(System.in);
System.out.print("Enter Basic: ");
double basic=input.nextDouble();
System.out.print("Enter Tax(%): ");
double tax=input.nextDouble();
double tda=basic*.75;
double thra=basic*.20;
int medical=1250;
double grosssalary=tda+thra+basic+medical;
System.out.println("Gross Salary: "+grosssalary);
double taxpaid=tax/100;
double t=taxpaid * grosssalary;
System.out.println("Tax to be paid is: "+t);
double netsalary=grosssalary-t;
System.out.println("Net Salary: "+netsalary);
DecimalFormat df=new DecimalFormat("##.##");
System.out.println(df.format(netsalary));
}
}
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.