Introduction to the sorted arraylist, Computer Engineering

Assignment Help:

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.


Related Discussions:- Introduction to the sorted arraylist

Explain the uses of thumbwheels, Explain the uses of thumbwheels Two t...

Explain the uses of thumbwheels Two thumbwheels are usually required to control the screen cursor in its horizontal and vertical position respectively. As the name implies,

Program in c, addition c program for token separation

addition c program for token separation

Difference between latches and flip-flops based designs, What is the differ...

What is the difference between latches and flip-flops based designs Latches are level sensitive whether flip-flops are edge sensitive. So, latch based design and flop based des

What is stack addressing, Q. What is Stack Addressing? In this addressi...

Q. What is Stack Addressing? In this addressing technique operand is implied as top of stack. It isn't explicit however implied. It employs a CPU Register known as Stack Pointe

Write program to simulate conversation with an old and deaf, You are going ...

You are going to write a program to simulate a conversation with an old, deaf relative. You can type your statements, and whatever you say, the relative will reply randomly with on

Define the node of object oriented modeling, Define the node of object orie...

Define the node of object oriented modeling A node is a physical element which exists at runtime and represents a computational resource usually having a large memory and often

What are the advantages of interviewing, What are the Advantages of Intervi...

What are the Advantages of Interviewing - Opportunity to motivate interviewee to give open and free answers to analyst's questions    -  allows analyst to probe for more f

What is graceful degradation, What is graceful degradation? In multipro...

What is graceful degradation? In multiprocessor systems, failure of one processor will not halt the system, but only slow it down by sharing the work of failure system by other

Explain advantages and disadvantages of static document, Explain Advantages...

Explain Advantages and Disadvantages of Static Document. The chief advantages of a static document are reliability, performance and simplicity. A browser can display a static d

Illustrate the benefits of functional model, Illustrate the benefits of Fun...

Illustrate the benefits of Functional model Functional model shows how values are computed. This model describes decisions or object structure without regard for sequencing. I

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd