Likes

Java Lab02_Ans4

Write a program that will store the employee records, such as employee ID, employee name, department, designation,
date of joining, date of birth, and marital status, in an array. In addition, the stored record needs to be displayed.

ANSWER


public class employeerecord

  string employeeDetails [] [] = new String [1] [7];
    public void storeData() {
 
   employeeDeatils [0] [0] = "A101";
   employeeDeatils [0] [1] = "john mathew";
   employeeDetails [0] [2] = "admin";
   employeeDetails [0] [3] = "manager";
   employeeDetails [0] [4] = "05/04/1998";
   employeeDetails [0] [5] = "11/09/1997";
   employeeDetails [0] [6] = "married";
 }
    public void displayData() {
     system.out.println ("Employee Details:");
    for ( int i = 0; i < employeeDetails,length;
    for ( int j = 0; j < employeeDetails[i].length; j++ {

      system.out.println(employeeDetails[i] [j] );
    }
 }


}

     public static void main (String [] args) {
      EmployeeRecord obj = new EmployeeRecord();
      obj.storeData();
     obj.displayData();
  }

}

No comments: