NEP -JAVA

PROGRAM 1 PROGRAM 2 PROGRAM 3 PROGRAM 4 PROGRAM 5 PROGRAM 6

PART B

PROGRAM B1 PROGRAM B2 PROGRAM B3 PROGRAM B4 PROGRAM B5 PROGRAM B6 PROGRAM B7 PROGRAM B8 . . .

 
   
 
/*

6.Program to define a class called employee with the name and date of appointment. Create
ten employee objects as an array and sort them as per their date of appointment. ie, print
them as per their seniority.
*/


import java.util.*;

class employee

{

String name;

Date appdate;

public employee(String nm,Date apdt)

{

name=nm;

appdate=apdt;

}

public void display()

{

System.out.println("employee name:"+name+"  appoinment date:"+  appdate.getDate()+"/" +appdate.getMonth()+"/"+appdate.getYear());

}

}

class program6

{

public static void main(String as[])

{

employee emp[]=new employee[5];

emp[0]=new employee("shaha PD",new Date(1999,05,22));

emp[1]=new employee("Patil AS",new Date(2000,01,12));
emp[2]=new employee("Phadake PV",new Date(2009,04,25));
emp[3]=new employee("Shinde SS",new Date(2005,02,19));

emp[4]=new employee("Shrivastav RT",new Date(2010,01,01));


System.out.println("List of employees");

for(int i=0;i< emp.length;i++)

emp[i].display();

for(int i=0;i< emp.length;i++)

{

for(int j=0;j< emp.length;j++)

{


if(emp[i].appdate.after(emp[j].appdate))

{

employee t=emp[i];

emp[i]=emp[j];

emp[j]=t;

}

}

}

System.out.println("List of employees seniority wise");

for(int i=0;i< emp.length;i++)

emp[i].display();

}

}