You are on page 1of 2

.Employee Details-Practical pgm-2 /*Employee Program*/ import java.io.

*; class Employee { int id,age,salary; String name,dept; DataInputStream ob=new DataInputStream(System.in); void get()throws IOException { System.out.println("Enter the Employee no:"); id=Integer.parseInt(ob.readLine()); System.out.println("Enter the Employee name:"); name=ob.readLine(); System.out.println("Enter the Employee Age:"); age=Integer.parseInt(ob.readLine()); System.out.println("Enter the Employee Department Name:"); dept=ob.readLine(); System.out.println("Enter the Employee Basic Salary:"); salary=Integer.parseInt(ob.readLine()); } void disp()throws IOException { System.out.println(id+" "+"\t"+name+" "+"\t\t"+age+" "+"\t\t"+dept+" "+"\t\t"+salary); /*System.out.println("Staff Id:"+id);System.out.println("Staff Name:"+name); System.out.println("Staff age:"+age);System.out.println("Staff sex:"+sex); System.out.println("Staff Department"+dept);System.out.println("Staff Salary:"+salary);*/ } } class pract2 { public static void main(String aa[])throws IOException { Employee obj[]=new Employee[5]; int i; for(i=0;i<5;i++) { obj[i]=new Employee(); obj[i].get(); } System.out.println("\t\t\t"+"Employee Details"+"\t\t"); System.out.println("Empno"+"\t"+"Emp name"+"\t"+"Emp Age"+"\t"+"Emp dept"+"\t"+"Emp salary"); for(i=0;i<5;i++) { obj[i].disp();

} } }

You might also like