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
? Activities: An activity shows an action that performed in the system. ? Transitions: Transitions are shown by open arrow heads. Transitions are used to specify the flow among

APPLICATIONS OF PARALLEL PROCESSING Parallel computing is an development of sequential computing which tries to emulate what has always been the condition of affairs in natural

Give some examples of malicious data. In May 2002 year, the Norton Anti-Virus software for Windows operating systems detected around 61000 malicious programs. Several of them a

The PHP Hypertext Pre processor is a programming language that permits web developers to make dynamic content that interacts with databases. PHP is basically used for developing we

what are the steps to implement bus topology?

In general, all public processes of a controller class are treated as action processes. If you require prevent this default behaviour, just decorate the public process with NonActi

Question 1: What do you meant by ERP? What are the benefits of ERP? Definition of ERP Question 2: Describe briefly the advantages of the ERP. Explanation of six advanta

Example:                         CMP    AX,BX    ; compare instruction: sets flags JE        THERE    ; if equal then skip the ADD instruction  ADD  AX, 02    ; add 02

What will occur when contents of register are shifter left, right? This is well known that into left shift all bits will be shifted left and LSB will be appended along with 0 a

Q. Example on Sorting using Combinational Circuit? Example: Think about a unsorted list having element values like given below {3,9,8,5,10,12,14,20,90,95,60,40,23,35,18,0}