Create a class Employee and accept the name and monthly salary of 50 employees. Write a program to calculate and display the name and annual salary of the employees who earn more than Rs. 80.000 per annum.
who will answer it correctly with steps I'll make him brain list
Answers
import java.util.Scanner;
public class KboatEmployeeTax
{
public void tax(String name, int income) {
double tax;
if (income <= 250000)
tax = 0;
else if (income <= 500000)
tax = (income - 250000) * 0.1;
else if (income <= 1000000)
tax = 30000 + ((income - 500000) * 0.2);
else
tax = 50000 + ((income - 1000000) * 0.3);
System.out.println("Name: " + name);
System.out.println("Income Tax: " + tax);
}
public static void main(String args[]) {
Scanner in = new Scanner(System.in);
System.out.print("Enter name: ");
String n = in.nextLine();
System.out.print("Enter annual income: ");
int i = in.nextInt();
KboatEmployeeTax obj = new KboatEmployeeTax();
obj.tax(n, i);
}
}