I just need someone to make the datum object. Posting the whole assignment for r
ID: 3566603 • Letter: I
Question
I just need someone to make the datum object. Posting the whole assignment for reference. That said, instant best answer if you do the whole thing
Objective:
Become familiar with the dynamic allocation of array storage
Become familiar with Liked Lists
Become familiar with referencing objects
Become familiar with the computational and space
Description:
Create an abridged version of a Linked List class that mimics Java's Linked List. The project should contain a Datum class that describes a single data point and myLList that defines the object Linked List with all of its instance variables and method.
(30 points) Project requirements:
Your program should contain two objects with the following criteria:
An object named Datum that describes a single data item in the Linked List.
The Datum object should contain a default constructor.
The Datum object should contain an alternate constructor that initializes the objects content variable.
All instance variables should be private.
Should make proper use of getters and setters.
An object named myLList that utilizes Datum object in order to define a Linked List.
Should contain a default constructor.
Should contain an alternate constructor myLList(int[] anArray) that allows the user to create a myLList from an array.
Should contain an alternate constructor myLList( myLList anExample) that will create a myLList identical to one that is passed to it.
Should contain an add method that appends an item to the end of the list.
Should contain a void add(int index, int value) method that inserts value at position index.
Need to check for appropriate index. If index is outside of the list boundaries, then add at the beginning or the end
Should contain an int remove(int index) method
If the index is outside of the list boundaries, then remove the first or last element
Should contain boolean contains(int value) method
Should contain an int get(int index) method
If index is out of boundary then return either the first or last element
Should contain an int indexOf(int value) method
Returns the index of the first occurrence of value
Should contain a boolean isEmpty() method
Should contain an int size() method
Should contain a void clear() method that empties the myLList
Should contain a void print() method that prints all elements of the myLList in one row delimited by one space
Should contain a copy(myLList) method that copies the content of the passed argument to the calling argument.
Should contain an equal(myLList) method that returns true if the two linked lists are identical and false if they are different.
Submission Notes:
Your final submission should consists of at least two .java files: myLList.java and Datum.java. You are free to include whatever main.java files that you used to test your work. Here is my LList project (winzip version) from class. You are free to use this as your starting point.
Example main:
You should be responsible for creating and testing your own main. I will provide one simple one just to make sure that everyone is using the correct names.
Explanation / Answer
public class Datum {
private int data;
private Datum next;
public Datum(){
this.data=0;
this.next=null;
}
public Datum(int value) {
setData(value);
this.data=value;
this.next=null;
}
public void print(){
System.out.print(getData() + " ");
}
public int getData() {
return data;
}
public void setData(int data) {
this.data = data;
}
public Datum getNext() {
return next;
}
public void setNext(Datum next) {
this.next = next;
}
}