Introduction to the sorted arraylist, Computer Engineering

Consider  a  collection  class  that  is  similar  to  the ArrayList  class,  except  that  elements  are sorted in a certain order. We will call this class SortedArrayList. This class has many of the same simple features  that  the ArrayList class has, but  it also has some new features  that  is different to the ArrayList class. 

The main difference is that each element (which can be of any class type) that is added into the  SortedArrayList  also  has  a  corresponding  priority,  which  is  a  decimal  number.  All elements  in  the  SortedArrayList  need  to  be  sorted  in  descending  order  (highest  priority comes first) according to their priorities at all times.

For example, if there is a list of String objects, with values "A", "B", "C" and "D", and their corresponding  priorities  are  62,  13,  71  and  38,  then  the  Strings  should  appear  in  the SortedArrayList in this order:
 
"C" (with priority 71), "A" (62), "D" (38), "B" (13)
 
In Part  1  of  the Assignment,  your  task  is  to write  the SortedArrayList  class  (its  instance variables, constructor and instance methods) as well as perform thorough unit testing on this class.

You should download SortedArrayList.java from the course website to help you get started.
 
·  It  already  contains  the  headers  of  the methods  (including  the  constructor)  that  you must write. Each method is described with a comment above the method header; you have to write the code inside the methods to perform according to the comment. You should NOT change any of the method headers.

·  You may choose to write more methods if that helps you. ·  There  is  already  1  instance  variable  declared;  you must NOT  change  this  instance variable declaration.

Posted Date: 2/22/2013 2:21:21 AM | Location : United States







Related Discussions:- Introduction to the sorted arraylist, Assignment Help, Ask Question on Introduction to the sorted arraylist, Get Answer, Expert's Help, Introduction to the sorted arraylist Discussions

Write discussion on Introduction to the sorted arraylist
Your posts are moderated
Related Questions
Question: (a) What are the rationales for an effective and independent regulator? (b) Across Africa, regulators have established Universal Service Funds (USFs) in order to

Rentrag has decided to replace all of the computers currently being used by all of the business and office staff. He has asked you to recommend a set of specification for computers

a. Explain the Programming Paradigm? Discuss four major programming paradigms. b. State the three basic logic operators available in C++? Write a small program in C++ that uses

Q. What is Read-only-Memory? Read only memory is an illustration of a Programmable Logic Device (PLD) it implies that binary information which is stored within a PLD is specifi

Explain the Structure of Virtual Enterprise. The effective enterprise can be a suitable structure to explore the emerging opportunities for creating value within the informatio

The Prisoner's Dilemma is a well-known problem in game theory. Two thieves are arrested and held in custody separately. The police offer each the same deal. Inform on your partn

Q. Explain about Microprocessors? Microprocessors have instruction sets ranging from 20 to several hundred instructions, known as microprograms, which are stored in ROM to init

What is NULL POINTER Inside main, a FILE * called file. Afterwards, the fopen function, passing it the path to data file, as well as "r", only intending to read from the file.

What is turnaround time? Turnaround time is the interval from the time of submission to the time of completion of a process. It is the sum of the periods spent waiting to get i

Write the Add/subtract rule for floating point numbers. Ans: a. Select the number with the smaller exponent and shift its mantissa right a number of steps equal to the differe