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

What is FIFO, What is FIFO? FIFO is used as buffering element or queui...

What is FIFO? FIFO is used as buffering element or queuing element into the system that is by common sense, is needed only while you slow at reading than the write operation.

Define the arithmetic micro-operations, Q. Define the Arithmetic Micro-oper...

Q. Define the Arithmetic Micro-operations? These micro-operations execute simple arithmetic operations on numeric data stored in registers. The fundamental arithmetic micro-ope

What is replacement policy in cache, Q.What is Replacement Policy in cache?...

Q.What is Replacement Policy in cache? When a new block has to be fetched in cache the other block may have to be replaced to make room for new block. Replacement policy determ

Development tools environment , Main Objectives: • MPLAB In-Circuit Debugg...

Main Objectives: • MPLAB In-Circuit Debugger (ICD 2) functionality • ICD 2 Connection design • MPLAB ICD 2 setup with the PC and Interface board designed • I²C Protocol buses tech

What is presentation layer, Q. What is Presentation layer? Presentatio...

Q. What is Presentation layer? Presentation layer: When two hosts are communicating with each other they might use different coding standards and character sets for represent

Draw state diagram, Draw the state diagram of a process from its creation t...

Draw the state diagram of a process from its creation to termination, including all transitions, and briefly elaborate every state and every transition. When a process executes

Explain about quarter inch cartridge tapes, Q. Explain about Quarter Inch C...

Q. Explain about Quarter Inch Cartridge Tapes? Quarter Inch Cartridge Tapes (QIC Standard): These tape cartridges record information sequentially in a track with one head. Wh

What are the limitations of mobile devices, What are the limitations of mob...

What are the limitations of mobile devices? For mobile devices we require both PC-integrated applications and specialized mobile services quite than repurposed website content.

In pram model steps required for executing an algorithm, Q. In PRAM model s...

Q. In PRAM model steps required for executing an algorithm? Subsequent steps are performed by a PRAM model whenever executing an algorithm: i) Read phase: First the N proc

Distinguish between combinational & sequential logic circuit, Distinguish b...

Distinguish between combinational logic circuits and sequential logic circuits. Ans: Combinational logic circuits:- (i) Outputs only depend upon present state of the 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