
Create an Employee class which has methods netSalary which would accept salary & tax as arguments & returns the netSalary which is tax deducted from the salary. Also it has a method grade which would accept the grade of the employee & return grade.

Hi Friend,
Try the following code:
import java.util.*;
class Employee
{
static Scanner input=new Scanner(System.in);
public double netSalary(double salary, double taxrate){
double tax=salary*taxrate;
double netpay=salary=tax;
return netpay;
}
public static String grade( ){
System.out.print("Enter Grade: ");
String grade=input.next();
return grade;
}
public static void main(String[] args){
Employee emp=new Employee();
System.out.print("Enter Salary: ");
double sal=input.nextDouble();
System.out.print("Enter Tax in %: ");
double taxrate=input.nextDouble()/100;
System.out.println("Net Salary is: "+net);
String g=emp.grade();
double net=emp.netSalary(sal,taxrate);
System.out.println("Grade is: "+g);
}
}
Thanks
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.