Monday, July 27, 2009

10 points if you manage to change this Insertion sort to Bubble sort?

/ objectSort.java


// demonstrates sorting objects (uses insertion sort)


// to run this program: C%26gt;java libmainsys


//////////////////////////////////////...


class libary


{


private String booktitle;


private String bookauthor;


private String publisher;





private int nofcop;





public libary(String title, String author, String pub, int nfcp)


{ // constructor


booktitle = title;


bookauthor = author;


publisher = pub;





nofcop = nfcp;


}





public void displaylibary()


{


System.out.print(" Book Title: " + booktitle);


System.out.print(", Book Author: " + bookauthor);


System.out.print(", Book Publisher: " + publisher);





System.out.println(",No Of Copies : " + nofcop);


}





ublic String getLast() // get title


{ return booktitle; }


} // end class libary





class ArrayInOb


{


private libary[] nfcp; // ref to array ypub


private int nElems; // number of data items

10 points if you manage to change this Insertion sort to Bubble sort?
That's not a question - that's a request to completely rewrite a chunk of code from scratch. You're unlikely to get any response here... especially as this is so obviously a piece of homework...





p.s. Someone always gets 10 points, even if you don't offer them up as some kind of "special reward". This could be considered "point-gaming".

survey research

No comments:

Post a Comment