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
Q. How to Load DOS from Hard Disk? To Load DOS from the Hard Disk of your computer, follow these steps: 1. Turn on the power ON/OFF switch of the CPU unit of your PC the pow

Enumerate the History of computers Basic information about technological development trends in computer in past and its projections in future. If you want to know about compute

Binary codes exist for any fundamental representation. Binary codes can be created for any set of discrete elements for example colors, spectrum, musical notes, chessboard position

Q. Define looping in assembly language? LOOPING  ; Program: Assume a constant inflation factor that is added to a series of prices ; stored in the memory. The program

Q. Define syntax of barrier directive? Barrier Directive  The syntax of barrier directive is  #pragma omp barrier When a thread attains barrier it waits till all threa

Digital circuits also manipulate logicalexpressione.g. IF account is in credit THEN allow phoneto make calls.So a digital circuit must determine if somethingis TRUE or FALSE. Norma

Data can be handled by using the features of Import text wizard and export text wizard. Here you can keep the operation for future use. First you should edit the specification name


Input a list of positive numbers (terminated by 0) into an array. Find the largest number in the array, and into the result. Use a subprogram to input the numbers, a function to fi

is a technique of improving the priority of process waiting in Queue for CPU allocation? Ageing is a technique of enhancing the priority of process waiting in Queue for CPU all