The employees of a firm are
classified into four grades (1,2,3,4) and given salary computed
by a formula 1200 * (5-A)+250 * B +200
A denotes the grade
B denotes the number of years of
experience
Write a program in java to
compute the salary of the following staff
Name Grade Experience
Rida Fatima 1 4
Disha Gupta 1 4
Niharika Bose 3 2
Sangita Das 2 2
import java.util.*;
public class Sal
{
String name;
int grade, ex,sal;
public void salary()
{
for(int i=0;i<=3;i++)
{
Scanner sc=new
Scanner(System.in);
System.out.print("\nName of Enployee:");
name=sc.nextLine();
System.out.print("\nGrade:");
grade=sc.nextInt();
System.out.print("\nNumber of Years of Experience:");
ex=sc.nextInt();
sal=1200*(5-grade)+250*ex+200;
System.out.print("\nSalary of "+ name+ " :"+sal);
sc.close();
}
}
public static void main(String args[])
{
Sal ob=new Sal();
ob.salary();
}
}
No comments:
Post a Comment