employee
import java.util.*;
class Employee
{
String empName;
String empId;
int Salary;
Scanner sc=new Scanner(System.in);
void setempName(String n)
{
empName=n;
}
void setempId(String Id)
{
empId=Id;
}
void setSalary(int s)
{
Salary=s;
}
String getempName()
{
return empName;
}
int getSalary()
{
return Salary;
}
String getempId()
{
return empId;
}
void incrementSalary()
{
Salary=(int)Salary+(int)(Salary*0.2);
}
}
class emp
{
public static void main(String agrs[])
{
Employee e=new Employee();
e.setempName("Sanket Koshti");
e.setempId("1234abcd");
e.setSalary(20000);
System.out.println("Name :"+e.getempName());
System.out.println("Employee ID :"+e.getempId());
System.out.println("EMployee Salary :"+e.getSalary());
System.out.println("After incrementing the salary :");
e.incrementSalary();
System.out.println("Name :"+e.getempName());
System.out.println("Employee ID :"+e.getempId());
System.out.println("EMployee Salary :"+e.getSalary());
}
}
Comments
Post a Comment