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

Subtract, Write the Add/subtract rule for floating point numbers. Ans:...

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

Which device converts BCD to seven segment, A device which converts BCD to ...

A device which converts BCD to Seven Segment is called ? Ans. DECODER is a device that converts BCD to Seven Segment. This coverts binary words in alphanumeric characters.

What are the concerns for growth of e-commerce in india, What are the conce...

What are the concerns for growth of e-commerce in India? Government as Facilitator for the growth of e-commerce has taken following steps: a. Promotion of competitive dataco

Distinguish between http and true streaming, Question: 1. Distinguish ...

Question: 1. Distinguish between HTTP and True streaming, stating the advantages and disadvantages of both type of media streaming. 2. Name two online services which provi

Define http, Http Hyper Text Transfer Protocol: The WWW protocol that...

Http Hyper Text Transfer Protocol: The WWW protocol that performs the request and regain functions of a server. Generally seen as the first part of a website address. It is t

How can server communicate with more than one client, Server can interact w...

Server can interact with more than one client with using threading concepts there are java threads which are allocated to each client when he logs in to server, the thread handles

What is server in sap terminology, What is Server in SAP terminology? ...

What is Server in SAP terminology? A component can having of one process or a group and is then known as the server for the respective service.

Categorized the optimization transformations, Categorized Optimization tr...

Categorized Optimization transformations The structure of program and the way in that data is defined and used in this provide vital clues for optimization. Optimization t

Discuss the advantages of store program control, Discuss the advantages of ...

Discuss the advantages of store program control (SPC) automation in telephone switching. Advantages of SPC: (i) Simple to control (ii) Simple to maintain (iii) Fine-

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