• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Most Difficult Assignment

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OPERATION BADAR
COMPULSORY ASSIGNMENT FOR STUDENTS WHO HAVE COMPLETED MODULE 9
Though the most efficient choice to hold a group of objects is an array, its size is fixed and this can be a constraint if number of elements is not known at compile-time. If we don’t don’t know in advance how many objects we would be storing, we can use Vector class of java.util package that, unlike an array, expands automatically when required and there is no limit to the number of elements one can add into it. This class implements the java.util.Collection interface. For this assignment, you have to write your own collection class with the name BadarVector implementing BadarCollection interface and having functionality and efficiency as much equivalent as possible to the Vector class. Also, one often needs to traverse through the sequence of stored objects. In case of using the java.util.Vector class, the method iterator() of this class returns an object of the Iterator type. The methods of this object are, in turn, used for traversing through the structure. Write your own class for iteration having the name BadarIteration implementing BadarIterator interface and providing the desired functionality of lightweight traversing. The source code of the two above mentioned interfaces is written below:
public interface BadarCollection
{
void add( int index, Object element);
boolean add(Object o);
int capacity();
int size();
void clear();
Object elementAt(int index);
Object firstElement();
Object lastElement();
Object remove(int index);
boolean remove (Object o);
BadarIterator iterator();
}
public interface BadarIterator
{
boolean hasNext();
Object next();
}
Note: To measure the performance of your class methods, you can use System.currentTimeMillis() at the start and end of the main method of your test class. The difference of time will indicate the approximate time consumed to perform the actions specified in between. Just call any method, say addElement(Object), of your class a considerable number of times and note down the time it took main call to return. Then call method of the same name in the Vector class same number of times and compare the time difference
Who gesign this
 
"The Hood"
Posts: 8521
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You just want someone to do your homework for your??
:roll:
reply
    Bookmark Topic Watch Topic
  • New Topic