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
E Brokerage facilitates search & retrieval of Information The success factor of a brokerage is its ability to retain existing clients and to enhance their satisfaction by effec

What are the methods for handling deadlocks?  The deadlock problem can be dealt with in one of the three ways:  a. Use a protocol to prevent or avoid deadlocks, make sure th

Define the difference between union and structure The main difference between union and structure is the storage allocation. In Union , for each variable the compiler allocates

Q. Rules for calling assembly subroutines from? The rules for calling assembly subroutines from C are: (i)  Memory model: The calling program and called assembly programs sh

Resolution Method: For a minor miracle occurred in 1965 where Alan Robinson published his resolution method as uses a method to generalised version of the resolution rule of i

Explain Clone process. A clone process is generated using primitive type clone by duplicating its parent process. However unlike traditional processes it might be share its con

Question 1: a) What are the phases of video production? b) What do you mean by storyboards? c) What are the differences between Point and Area (or Paragraph) Text?

What are the blocks of microprocessor based system 1.  The Memory and I/O System 2.  The DOS Operating System 3.  The Microprocessor

The distinction is semantic. Traditionally, compiled executables (binaries) are known as programs, and interpreted programs are usually known as scripts. In the context of CGI, the

EXPLAIN SIDE EFFECT OF SCAN CONVERSION WITH DIGRAM