SlideShare ist ein Scribd-Unternehmen logo
1 von 2
Downloaden Sie, um offline zu lesen
Please help me to make a programming project I have to sue them today. Please help me make a
UnsortedList and SortedList classes. The instructor give me The code of the List and AbstracList
Classes that 2 pages we do not modify them. Do not modify this pages!!! List.java import
java.util.Iterator; /** * Represents List interface. * * @author Varik Hoang * @version Sep 26,
2016 * @param is of any object type. */ public interface List { /** * The method returns the
current number of elements in the list. * * @return the current number of elements in the list
greater than or equal 0 */ public int getSize(); /** * The method returns whether the list is empty.
* * @return true if list is empty, false otherwise. */ public boolean isEmpty(); /** * The method
returns whether value is in the list. * * @param value the value is assigned * @return true if
value in the list, false otherwise. */ public boolean contains(Type value); /** * The method
inserts an element into the list. * * @param value the value is assigned */ public void insert(Type
value); /** * The method clears the list. */ public void clear(); /** * The method returns a string
representation of list contents. * * @return a string representation of list contents. * @see
Object#toString() */ @Override public String toString(); /** * /** * The method removes first
element occurrence from the list. * * @param value the value is assigned * @return the removed
value */ public Type remove(Type value); /** * The method returns the index of value. * *
@param value the value is assigned. * @return the index of value if in the list, -1 otherwise. */
public int getIndex(Type value); /** * The method removes value at the given index. * *
@param index the index must be in range of 0 and size * @return the removed value * @throws
IndexOutOfBoundsException if index less than 0 or index greater than * or equal size */ public
Type removeAtIndex(int index); /** * The method replaces the value at the given index with the
given value. * * @param index the index must be in range of 0 and size * @param value the
value is assigned * @throws IndexOutOfBoundsException if index less 0 or index greater than
size */ public void set(int index, Type value); /** * Returns the value at the given index in the
list. * * @param index the index must be in range of 0 and size * @throws
IndexOutOfBoundsException if index less than 0 or greater size * @return the value at the given
index in the list. */ public Type get(int index); /** * The method returns an iterator for this list. *
* @return an iterator for the list. */ public Iterator iterator(); } Do not modify this pages public
abstract class AbstractList implements List { /** * The reference to the last element */ protected
ListNode tail; /** * The size of the list */ protected int size; /** * The constructor that initiate the
tail and size references */ public AbstractList() { tail = null; size = 0; } @Override public int
getSize() { return size; } @Override public boolean isEmpty() { return size == 0; } @Override
public int getIndex(final Type value) { if (value == null) throw new NullPointerException("The
value could not be null"); if (tail == null) return -1; ListNode current = tail.next; // point to head
for (int index = 0; index < size; index++) { if (current.data.equals(value)) return index; current =
current.next; } return -1; } @Override public String toString() { if (size == 0) return "[]";
StringBuilder builder = new StringBuilder(); builder.append("["); ListNode current = tail.next; //
head node while (current != tail) { builder.append(current.data).append(",").append(" "); current
= current.next; } builder.append(tail.data); builder.append("]"); return builder.toString(); } /** *
Returns an iterator for this list. * * @return an iterator for the list. */ public Iterator iterator() {
return new LinkedIterator(); } /** * Represents a list node. * * @author Building Java Programs
3rd ed. * @param is of any object type */ protected static class ListNode { /** * Data stored in
this node. */ public final Type data; /** * Link to next node in the list. */ public ListNode next;
/** * Constructs a node with given data and a null link. * * @param data assigned */ public
ListNode(Type data) { this(data, null); } /** * Constructs a node with given data and given link.
* * @param data assigned * @param next assigned */ public ListNode(Type data, ListNode
next) { this.data = data; this.next = next; } /** * The method returns the generic data type as
string */ public String toString() { return this.data.toString(); } } /** * The iterator class for the
list. * * @author modified from BuildingJavaPrograms 3rd Edition */ public class LinkedIterator
implements Iterator { /** * Location of current value to return. */ private ListNode current; /** *
The flag that tells if the first node has been visited. */ private boolean visited; /** * Constructs an
iterator for the given list. */ public LinkedIterator() { reset(); } /** * Returns whether there are
more list elements. * * @return true if there are more elements left, false otherwise * @see
java.util.Iterator#hasNext() */ public boolean hasNext() { if (tail != null) return !(current ==
tail.next && visited); else return false; } /** * Returns the next element in the iteration. * *
@throws NoSuchElementException if no more elements. * @return the next element in the
iteration. * @see java.util.Iterator#next() */ public Type next() { if (!hasNext()) { throw new
NoSuchElementException(); } Type result = current.data; current = current.next; visited = true;
return result; } /** * This method is not supported */ public void remove() { throw new
IllegalStateException("This iterator does not support remove operation"); } /** * The method
resets back to the beginning. */ public final void reset() { if (tail != null) current = tail.next;
visited = false; } } } Now you must only use the Todo tags to implement the methods for Both
Sorted and UnsortedList classes. Please compile with no errors! You can do sanity check below:
please make sure you passed all the sanity check before you posted the answers. Thank you!!!
http://18.224.94.128/course/index.php?contest=51&pass=1735

Weitere ähnliche Inhalte

Ähnlich wie Please help me to make a programming project I have to sue them today- (1).pdf

Hi,I have added the methods and main class as per your requirement.pdf
Hi,I have added the methods and main class as per your requirement.pdfHi,I have added the methods and main class as per your requirement.pdf
Hi,I have added the methods and main class as per your requirement.pdf
annaelctronics
 
LabProgram.javaimport java.util.NoSuchElementException;public .pdf
LabProgram.javaimport java.util.NoSuchElementException;public .pdfLabProgram.javaimport java.util.NoSuchElementException;public .pdf
LabProgram.javaimport java.util.NoSuchElementException;public .pdf
fantasiatheoutofthef
 
STAGE 2 The Methods 65 points Implement all the methods t.pdf
STAGE 2 The Methods 65 points Implement all the methods t.pdfSTAGE 2 The Methods 65 points Implement all the methods t.pdf
STAGE 2 The Methods 65 points Implement all the methods t.pdf
babitasingh698417
 
Implementation The starter code includes List.java. You should not c.pdf
Implementation The starter code includes List.java. You should not c.pdfImplementation The starter code includes List.java. You should not c.pdf
Implementation The starter code includes List.java. You should not c.pdf
maheshkumar12354
 
please read the steps below and it will tell you what we usi.pdf
please read the steps below and it will tell you what we usi.pdfplease read the steps below and it will tell you what we usi.pdf
please read the steps below and it will tell you what we usi.pdf
aggarwalopticalsco
 
File LinkedList.java Defines a doubly-l.pdf
File LinkedList.java Defines a doubly-l.pdfFile LinkedList.java Defines a doubly-l.pdf
File LinkedList.java Defines a doubly-l.pdf
Conint29
 
Lecture 18Dynamic Data Structures and Generics (II).docx
Lecture 18Dynamic Data Structures and Generics (II).docxLecture 18Dynamic Data Structures and Generics (II).docx
Lecture 18Dynamic Data Structures and Generics (II).docx
SHIVA101531
 
please read below it will tell you what we are using L.pdf
please read below it will tell you what we are using   L.pdfplease read below it will tell you what we are using   L.pdf
please read below it will tell you what we are using L.pdf
ankit11134
 
package singlylinkedlist; public class Node { public String valu.pdf
package singlylinkedlist; public class Node { public String valu.pdfpackage singlylinkedlist; public class Node { public String valu.pdf
package singlylinkedlist; public class Node { public String valu.pdf
amazing2001
 
Dividing a linked list into two sublists of almost equal sizesa. A.pdf
Dividing a linked list into two sublists of almost equal sizesa. A.pdfDividing a linked list into two sublists of almost equal sizesa. A.pdf
Dividing a linked list into two sublists of almost equal sizesa. A.pdf
tesmondday29076
 
Please do parts labeled TODO LinkedList.java Replace.pdf
Please do parts labeled TODO LinkedList.java Replace.pdfPlease do parts labeled TODO LinkedList.java Replace.pdf
Please do parts labeled TODO LinkedList.java Replace.pdf
aioils
 
How do I fix it in javaLinkedList.java Defines a doubl.pdf
How do I fix it in javaLinkedList.java Defines a doubl.pdfHow do I fix it in javaLinkedList.java Defines a doubl.pdf
How do I fix it in javaLinkedList.java Defines a doubl.pdf
fmac5
 
How do I fix it in LinkedList.javaLinkedList.java Define.pdf
How do I fix it in LinkedList.javaLinkedList.java Define.pdfHow do I fix it in LinkedList.javaLinkedList.java Define.pdf
How do I fix it in LinkedList.javaLinkedList.java Define.pdf
mail931892
 
Given below is the completed implementation of MyLinkedList class. O.pdf
Given below is the completed implementation of MyLinkedList class. O.pdfGiven below is the completed implementation of MyLinkedList class. O.pdf
Given below is the completed implementation of MyLinkedList class. O.pdf
info430661
 
import java.util.Iterator; import java.util.NoSuchElementException; .pdf
  import java.util.Iterator; import java.util.NoSuchElementException; .pdf  import java.util.Iterator; import java.util.NoSuchElementException; .pdf
import java.util.Iterator; import java.util.NoSuchElementException; .pdf
deepakangel
 
03.DS_Store__MACOSX03._.DS_Store03A2.DS_Store__.docx
03.DS_Store__MACOSX03._.DS_Store03A2.DS_Store__.docx03.DS_Store__MACOSX03._.DS_Store03A2.DS_Store__.docx
03.DS_Store__MACOSX03._.DS_Store03A2.DS_Store__.docx
honey725342
 
How do I fix it in LinkedList.javathis is what i didLabProgra.pdf
How do I fix it in LinkedList.javathis is what i didLabProgra.pdfHow do I fix it in LinkedList.javathis is what i didLabProgra.pdf
How do I fix it in LinkedList.javathis is what i didLabProgra.pdf
mail931892
 
Need Help!! C++ #include-iostream- #include-linkedlist-h- using namesp.pdf
Need Help!! C++ #include-iostream- #include-linkedlist-h- using namesp.pdfNeed Help!! C++ #include-iostream- #include-linkedlist-h- using namesp.pdf
Need Help!! C++ #include-iostream- #include-linkedlist-h- using namesp.pdf
Edwardw5nSlaterl
 
In this lab, we will write an application to store a deck of cards i.pdf
In this lab, we will write an application to store a deck of cards i.pdfIn this lab, we will write an application to store a deck of cards i.pdf
In this lab, we will write an application to store a deck of cards i.pdf
contact41
 
The LinkedList1 class implements a Linked list. class.pdf
The LinkedList1 class implements a Linked list. class.pdfThe LinkedList1 class implements a Linked list. class.pdf
The LinkedList1 class implements a Linked list. class.pdf
malavshah9013
 

Ähnlich wie Please help me to make a programming project I have to sue them today- (1).pdf (20)

Hi,I have added the methods and main class as per your requirement.pdf
Hi,I have added the methods and main class as per your requirement.pdfHi,I have added the methods and main class as per your requirement.pdf
Hi,I have added the methods and main class as per your requirement.pdf
 
LabProgram.javaimport java.util.NoSuchElementException;public .pdf
LabProgram.javaimport java.util.NoSuchElementException;public .pdfLabProgram.javaimport java.util.NoSuchElementException;public .pdf
LabProgram.javaimport java.util.NoSuchElementException;public .pdf
 
STAGE 2 The Methods 65 points Implement all the methods t.pdf
STAGE 2 The Methods 65 points Implement all the methods t.pdfSTAGE 2 The Methods 65 points Implement all the methods t.pdf
STAGE 2 The Methods 65 points Implement all the methods t.pdf
 
Implementation The starter code includes List.java. You should not c.pdf
Implementation The starter code includes List.java. You should not c.pdfImplementation The starter code includes List.java. You should not c.pdf
Implementation The starter code includes List.java. You should not c.pdf
 
please read the steps below and it will tell you what we usi.pdf
please read the steps below and it will tell you what we usi.pdfplease read the steps below and it will tell you what we usi.pdf
please read the steps below and it will tell you what we usi.pdf
 
File LinkedList.java Defines a doubly-l.pdf
File LinkedList.java Defines a doubly-l.pdfFile LinkedList.java Defines a doubly-l.pdf
File LinkedList.java Defines a doubly-l.pdf
 
Lecture 18Dynamic Data Structures and Generics (II).docx
Lecture 18Dynamic Data Structures and Generics (II).docxLecture 18Dynamic Data Structures and Generics (II).docx
Lecture 18Dynamic Data Structures and Generics (II).docx
 
please read below it will tell you what we are using L.pdf
please read below it will tell you what we are using   L.pdfplease read below it will tell you what we are using   L.pdf
please read below it will tell you what we are using L.pdf
 
package singlylinkedlist; public class Node { public String valu.pdf
package singlylinkedlist; public class Node { public String valu.pdfpackage singlylinkedlist; public class Node { public String valu.pdf
package singlylinkedlist; public class Node { public String valu.pdf
 
Dividing a linked list into two sublists of almost equal sizesa. A.pdf
Dividing a linked list into two sublists of almost equal sizesa. A.pdfDividing a linked list into two sublists of almost equal sizesa. A.pdf
Dividing a linked list into two sublists of almost equal sizesa. A.pdf
 
Please do parts labeled TODO LinkedList.java Replace.pdf
Please do parts labeled TODO LinkedList.java Replace.pdfPlease do parts labeled TODO LinkedList.java Replace.pdf
Please do parts labeled TODO LinkedList.java Replace.pdf
 
How do I fix it in javaLinkedList.java Defines a doubl.pdf
How do I fix it in javaLinkedList.java Defines a doubl.pdfHow do I fix it in javaLinkedList.java Defines a doubl.pdf
How do I fix it in javaLinkedList.java Defines a doubl.pdf
 
How do I fix it in LinkedList.javaLinkedList.java Define.pdf
How do I fix it in LinkedList.javaLinkedList.java Define.pdfHow do I fix it in LinkedList.javaLinkedList.java Define.pdf
How do I fix it in LinkedList.javaLinkedList.java Define.pdf
 
Given below is the completed implementation of MyLinkedList class. O.pdf
Given below is the completed implementation of MyLinkedList class. O.pdfGiven below is the completed implementation of MyLinkedList class. O.pdf
Given below is the completed implementation of MyLinkedList class. O.pdf
 
import java.util.Iterator; import java.util.NoSuchElementException; .pdf
  import java.util.Iterator; import java.util.NoSuchElementException; .pdf  import java.util.Iterator; import java.util.NoSuchElementException; .pdf
import java.util.Iterator; import java.util.NoSuchElementException; .pdf
 
03.DS_Store__MACOSX03._.DS_Store03A2.DS_Store__.docx
03.DS_Store__MACOSX03._.DS_Store03A2.DS_Store__.docx03.DS_Store__MACOSX03._.DS_Store03A2.DS_Store__.docx
03.DS_Store__MACOSX03._.DS_Store03A2.DS_Store__.docx
 
How do I fix it in LinkedList.javathis is what i didLabProgra.pdf
How do I fix it in LinkedList.javathis is what i didLabProgra.pdfHow do I fix it in LinkedList.javathis is what i didLabProgra.pdf
How do I fix it in LinkedList.javathis is what i didLabProgra.pdf
 
Need Help!! C++ #include-iostream- #include-linkedlist-h- using namesp.pdf
Need Help!! C++ #include-iostream- #include-linkedlist-h- using namesp.pdfNeed Help!! C++ #include-iostream- #include-linkedlist-h- using namesp.pdf
Need Help!! C++ #include-iostream- #include-linkedlist-h- using namesp.pdf
 
In this lab, we will write an application to store a deck of cards i.pdf
In this lab, we will write an application to store a deck of cards i.pdfIn this lab, we will write an application to store a deck of cards i.pdf
In this lab, we will write an application to store a deck of cards i.pdf
 
The LinkedList1 class implements a Linked list. class.pdf
The LinkedList1 class implements a Linked list. class.pdfThe LinkedList1 class implements a Linked list. class.pdf
The LinkedList1 class implements a Linked list. class.pdf
 

Mehr von seoagam1

Prepare the Journal entries for each Transactions 44- The Watson Foun.pdf
Prepare the Journal entries for each Transactions  44- The Watson Foun.pdfPrepare the Journal entries for each Transactions  44- The Watson Foun.pdf
Prepare the Journal entries for each Transactions 44- The Watson Foun.pdf
seoagam1
 
Prepare journal entries to record the following merchandising transact.pdf
Prepare journal entries to record the following merchandising transact.pdfPrepare journal entries to record the following merchandising transact.pdf
Prepare journal entries to record the following merchandising transact.pdf
seoagam1
 
Preoperative diagnosis- Morbid obesity Procedure- Cancellation of gast.pdf
Preoperative diagnosis- Morbid obesity Procedure- Cancellation of gast.pdfPreoperative diagnosis- Morbid obesity Procedure- Cancellation of gast.pdf
Preoperative diagnosis- Morbid obesity Procedure- Cancellation of gast.pdf
seoagam1
 
Preliminary phase- Acknowledgement phase- Transitional phase- Resoluti.pdf
Preliminary phase- Acknowledgement phase- Transitional phase- Resoluti.pdfPreliminary phase- Acknowledgement phase- Transitional phase- Resoluti.pdf
Preliminary phase- Acknowledgement phase- Transitional phase- Resoluti.pdf
seoagam1
 
Please use the code below and make it operate as one program- Notating.pdf
Please use the code below and make it operate as one program- Notating.pdfPlease use the code below and make it operate as one program- Notating.pdf
Please use the code below and make it operate as one program- Notating.pdf
seoagam1
 

Mehr von seoagam1 (20)

Prepare the Journal entries for each Transactions 44- The Watson Foun.pdf
Prepare the Journal entries for each Transactions  44- The Watson Foun.pdfPrepare the Journal entries for each Transactions  44- The Watson Foun.pdf
Prepare the Journal entries for each Transactions 44- The Watson Foun.pdf
 
Prepare journal entries to record the following merchandising transact.pdf
Prepare journal entries to record the following merchandising transact.pdfPrepare journal entries to record the following merchandising transact.pdf
Prepare journal entries to record the following merchandising transact.pdf
 
Prepare a partmers' capital statement for JL Company based on the foll.pdf
Prepare a partmers' capital statement for JL Company based on the foll.pdfPrepare a partmers' capital statement for JL Company based on the foll.pdf
Prepare a partmers' capital statement for JL Company based on the foll.pdf
 
Preoperative diagnosis- Morbid obesity Procedure- Cancellation of gast.pdf
Preoperative diagnosis- Morbid obesity Procedure- Cancellation of gast.pdfPreoperative diagnosis- Morbid obesity Procedure- Cancellation of gast.pdf
Preoperative diagnosis- Morbid obesity Procedure- Cancellation of gast.pdf
 
Prepare a classified balance sheet in good form- (List Current Assets.pdf
Prepare a classified balance sheet in good form- (List Current Assets.pdfPrepare a classified balance sheet in good form- (List Current Assets.pdf
Prepare a classified balance sheet in good form- (List Current Assets.pdf
 
Preliminary phase- Acknowledgement phase- Transitional phase- Resoluti.pdf
Preliminary phase- Acknowledgement phase- Transitional phase- Resoluti.pdfPreliminary phase- Acknowledgement phase- Transitional phase- Resoluti.pdf
Preliminary phase- Acknowledgement phase- Transitional phase- Resoluti.pdf
 
Practice Question You have discovered a creature while looking at some.pdf
Practice Question You have discovered a creature while looking at some.pdfPractice Question You have discovered a creature while looking at some.pdf
Practice Question You have discovered a creature while looking at some.pdf
 
Pow have the fullowine aldaional information- Senteickion a 42-4sin 1-.pdf
Pow have the fullowine aldaional information- Senteickion a 42-4sin 1-.pdfPow have the fullowine aldaional information- Senteickion a 42-4sin 1-.pdf
Pow have the fullowine aldaional information- Senteickion a 42-4sin 1-.pdf
 
Povet Compary is one of the worlds leading com refiners- It produces t.pdf
Povet Compary is one of the worlds leading com refiners- It produces t.pdfPovet Compary is one of the worlds leading com refiners- It produces t.pdf
Povet Compary is one of the worlds leading com refiners- It produces t.pdf
 
Post your responses to the following questions on infection control an.pdf
Post your responses to the following questions on infection control an.pdfPost your responses to the following questions on infection control an.pdf
Post your responses to the following questions on infection control an.pdf
 
Political Risk is also called Bank Risk Transportation Risk Economic R.pdf
Political Risk is also called Bank Risk Transportation Risk Economic R.pdfPolitical Risk is also called Bank Risk Transportation Risk Economic R.pdf
Political Risk is also called Bank Risk Transportation Risk Economic R.pdf
 
populition of 2-5 - and 10- Livied below ane the ene dilferent aanples.pdf
populition of 2-5 - and 10- Livied below ane the ene dilferent aanples.pdfpopulition of 2-5 - and 10- Livied below ane the ene dilferent aanples.pdf
populition of 2-5 - and 10- Livied below ane the ene dilferent aanples.pdf
 
Policymakers see integrated health information networks as a panacea f.pdf
Policymakers see integrated health information networks as a panacea f.pdfPolicymakers see integrated health information networks as a panacea f.pdf
Policymakers see integrated health information networks as a panacea f.pdf
 
polymorphism means building data with methods True False Question 12 (.pdf
polymorphism means building data with methods True False Question 12 (.pdfpolymorphism means building data with methods True False Question 12 (.pdf
polymorphism means building data with methods True False Question 12 (.pdf
 
Plz explainwell (d) Consider the following snippet of C code int i-a-.pdf
Plz explainwell  (d) Consider the following snippet of C code int i-a-.pdfPlz explainwell  (d) Consider the following snippet of C code int i-a-.pdf
Plz explainwell (d) Consider the following snippet of C code int i-a-.pdf
 
Please write solutions with work shown- Thank you- We pick at random a.pdf
Please write solutions with work shown- Thank you- We pick at random a.pdfPlease write solutions with work shown- Thank you- We pick at random a.pdf
Please write solutions with work shown- Thank you- We pick at random a.pdf
 
PLS help answer all wuestions 2) Explain why the tiktaalik was a key.pdf
PLS help answer all wuestions   2) Explain why the tiktaalik was a key.pdfPLS help answer all wuestions   2) Explain why the tiktaalik was a key.pdf
PLS help answer all wuestions 2) Explain why the tiktaalik was a key.pdf
 
Please use the following numbers to demonstrate how Diffie Hellman Key.pdf
Please use the following numbers to demonstrate how Diffie Hellman Key.pdfPlease use the following numbers to demonstrate how Diffie Hellman Key.pdf
Please use the following numbers to demonstrate how Diffie Hellman Key.pdf
 
Please use the code below and make it operate as one program- Notating.pdf
Please use the code below and make it operate as one program- Notating.pdfPlease use the code below and make it operate as one program- Notating.pdf
Please use the code below and make it operate as one program- Notating.pdf
 
Please use the following table of data for the 4 questions that follow.pdf
Please use the following table of data for the 4 questions that follow.pdfPlease use the following table of data for the 4 questions that follow.pdf
Please use the following table of data for the 4 questions that follow.pdf
 

Kürzlich hochgeladen

Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
KarakKing
 

Kürzlich hochgeladen (20)

This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 

Please help me to make a programming project I have to sue them today- (1).pdf

  • 1. Please help me to make a programming project I have to sue them today. Please help me make a UnsortedList and SortedList classes. The instructor give me The code of the List and AbstracList Classes that 2 pages we do not modify them. Do not modify this pages!!! List.java import java.util.Iterator; /** * Represents List interface. * * @author Varik Hoang * @version Sep 26, 2016 * @param is of any object type. */ public interface List { /** * The method returns the current number of elements in the list. * * @return the current number of elements in the list greater than or equal 0 */ public int getSize(); /** * The method returns whether the list is empty. * * @return true if list is empty, false otherwise. */ public boolean isEmpty(); /** * The method returns whether value is in the list. * * @param value the value is assigned * @return true if value in the list, false otherwise. */ public boolean contains(Type value); /** * The method inserts an element into the list. * * @param value the value is assigned */ public void insert(Type value); /** * The method clears the list. */ public void clear(); /** * The method returns a string representation of list contents. * * @return a string representation of list contents. * @see Object#toString() */ @Override public String toString(); /** * /** * The method removes first element occurrence from the list. * * @param value the value is assigned * @return the removed value */ public Type remove(Type value); /** * The method returns the index of value. * * @param value the value is assigned. * @return the index of value if in the list, -1 otherwise. */ public int getIndex(Type value); /** * The method removes value at the given index. * * @param index the index must be in range of 0 and size * @return the removed value * @throws IndexOutOfBoundsException if index less than 0 or index greater than * or equal size */ public Type removeAtIndex(int index); /** * The method replaces the value at the given index with the given value. * * @param index the index must be in range of 0 and size * @param value the value is assigned * @throws IndexOutOfBoundsException if index less 0 or index greater than size */ public void set(int index, Type value); /** * Returns the value at the given index in the list. * * @param index the index must be in range of 0 and size * @throws IndexOutOfBoundsException if index less than 0 or greater size * @return the value at the given index in the list. */ public Type get(int index); /** * The method returns an iterator for this list. * * @return an iterator for the list. */ public Iterator iterator(); } Do not modify this pages public abstract class AbstractList implements List { /** * The reference to the last element */ protected ListNode tail; /** * The size of the list */ protected int size; /** * The constructor that initiate the tail and size references */ public AbstractList() { tail = null; size = 0; } @Override public int getSize() { return size; } @Override public boolean isEmpty() { return size == 0; } @Override public int getIndex(final Type value) { if (value == null) throw new NullPointerException("The value could not be null"); if (tail == null) return -1; ListNode current = tail.next; // point to head for (int index = 0; index < size; index++) { if (current.data.equals(value)) return index; current = current.next; } return -1; } @Override public String toString() { if (size == 0) return "[]"; StringBuilder builder = new StringBuilder(); builder.append("["); ListNode current = tail.next; // head node while (current != tail) { builder.append(current.data).append(",").append(" "); current = current.next; } builder.append(tail.data); builder.append("]"); return builder.toString(); } /** * Returns an iterator for this list. * * @return an iterator for the list. */ public Iterator iterator() { return new LinkedIterator(); } /** * Represents a list node. * * @author Building Java Programs 3rd ed. * @param is of any object type */ protected static class ListNode { /** * Data stored in this node. */ public final Type data; /** * Link to next node in the list. */ public ListNode next; /** * Constructs a node with given data and a null link. * * @param data assigned */ public ListNode(Type data) { this(data, null); } /** * Constructs a node with given data and given link. * * @param data assigned * @param next assigned */ public ListNode(Type data, ListNode
  • 2. next) { this.data = data; this.next = next; } /** * The method returns the generic data type as string */ public String toString() { return this.data.toString(); } } /** * The iterator class for the list. * * @author modified from BuildingJavaPrograms 3rd Edition */ public class LinkedIterator implements Iterator { /** * Location of current value to return. */ private ListNode current; /** * The flag that tells if the first node has been visited. */ private boolean visited; /** * Constructs an iterator for the given list. */ public LinkedIterator() { reset(); } /** * Returns whether there are more list elements. * * @return true if there are more elements left, false otherwise * @see java.util.Iterator#hasNext() */ public boolean hasNext() { if (tail != null) return !(current == tail.next && visited); else return false; } /** * Returns the next element in the iteration. * * @throws NoSuchElementException if no more elements. * @return the next element in the iteration. * @see java.util.Iterator#next() */ public Type next() { if (!hasNext()) { throw new NoSuchElementException(); } Type result = current.data; current = current.next; visited = true; return result; } /** * This method is not supported */ public void remove() { throw new IllegalStateException("This iterator does not support remove operation"); } /** * The method resets back to the beginning. */ public final void reset() { if (tail != null) current = tail.next; visited = false; } } } Now you must only use the Todo tags to implement the methods for Both Sorted and UnsortedList classes. Please compile with no errors! You can do sanity check below: please make sure you passed all the sanity check before you posted the answers. Thank you!!! http://18.224.94.128/course/index.php?contest=51&pass=1735