Public class Employee
{
private String empno;
private String name;
private String title;
private double sal;
public employee()
{
empno = "";
name = "";
title = "";
sal =0;
}
public employee(String empno, String name, String title, double sal)
{
this.empno = empno;
this.name = name;
this.title = title;
this.sal =sal;
}
Public void newsal()
{
if(sal>50000)
sal = sal +(sal*0.03);
else if(sal >=25000 )
sal = sal + (sal*0.05);
else
sal = sal +(sal*0.07)
}
public string getempno()
{
return empno;
}
public string getname()
{
return name;
}
public string gettitle()
{
return title;
}
public double getsal()
{
return sal;
}
Public void replace(string title)
{
this.title = title;
}
}
public static final int num=300;
public static void main(String[]args)
{
Employee[]emp = new Employee[num];
input (emp);
increase(emp);
change(emp);
display(emp);
}
public static void(Employee[]emp)
{
for(int x = 0;x<num;x++)
{
string temp = JOptionPane.showInputDialog(null,"Please enter employee number")
string temp1 = JOptionPane.showInputDialog(null,"Please enter employee name")
string temp2 = JOptionPane.showInputDialog(null,"Please enter employee title")
string temp3 = JOptionPane.showInputDialog(null,"Please enter employee salary")
double sal = Double.parseDouble(temp3);
emp[x] =new Employee(temp,temp1,temp2,sal);
}
}
public static void increase(Employee[]emp)
{
for(int x =0;x<num ;x++)
{
if(emp[x].gettitle().equalsIgnoreCase("technicain") ;
emp[x].newsal();
}
}
public static void change(Employee[]temp)
{
for(int x =0;x<num ;x++)
{
if(emp[x].gettitle().equalsIgnoreCase("Secretary")
emp[x].gettitle()="Office Adminstrator";
}
}
public static void display(Employee[]emp)
{
System.out.print("EmpNo"+"Name"+"Title"+"Salary(R) "+"\t")
for(int x =0; x<num; x++)
{
System.out.println(emp[x].getempno()+emp[x].getname()+emp[x].gettitle()+emp[x].getsal+"\t");
}
}