help with java programming language please help by implement one large program o
ID: 3834237 • Letter: H
Question
help with java programming language
please help by implement one large program or 2 to 3 smaller programs of your choice, using all of the topics below. This is a collaborative project, It may take some time to develop a program topic or topics, which satisfy the final project requirements. Be sure to check with that your program is complex and large enough to satisfy the final project requirements. Your project should also have a real world component if possible. For example, you could create a scheduling program that makes use of a doubly linked list; a mock package delivery tracking system that uses priority queues; a program that can determine if a graph is two colorable for any given graph, etc. You can use some of the programming practice samples from the end of the chapters to get an idea.
Written report – including:
Detailed description of your project
Description of how each component works
Testing plan (How was it tested?)
Discussion of any difficulties your team encountered developing the project
Analysis using Big-O notation
The program must contain all of the following elements:
1. Use of at least three Abstract Data Types
2. Use of inheritance and polymorphism
3. Use of recursion
4. Connection and use of a simple database
5. At least one sorting algorithm
6. At least one search algorithm
7. Use of a graphical user interface
Explanation / Answer
public class Simle
{
private Node head;
private Node tail;
private int size;
public DoublyLinkedListImpl()
{
size = 0;
}
private class Node
{
E element;
Node next;
Node prev;
public Node(E element, Node next, Node prev)
{
this.element = element;
this.next = next;
this.prev = prev;
}
}
public int size() {
return size;
}
public boolean isEmpty()
{
return size == 0;
}
public void addFirst(E element)
{
Node tmp = new Node(element, head, null);
if(head != null ) {head.prev = tmp;}
head = tmp;
if(tail == null) { tail = tmp;}
size++;
System.out.println("adding: "+element);
}
public void addLast(E element)
{
Node tmp = new Node(element, null, tail);
if(tail != null)
{
tail.next = tmp;
head = tmp;
}
size++;
System.out.println("adding: "+element);
}
public void iterateForward()
{
System.out.println("iterating forward..");
Node tmp = head;
while(tmp != null)
{
System.out.println(tmp.element);
tmp = tmp.next;
}
}
public void iterateBackward()
{
System.out.println("iterating backword..");
Node tmp = tail;
while(tmp != null)
{
System.out.println(tmp.element);
tmp = tmp.prev;
}
}
public E removeFirst()
{
if (size == 0) throw new NoSuchElementException();
Node tmp = head;
head = head.next;
head.prev = null;
size--;
System.out.println("deleted: "+tmp.element);
return tmp.element;
}
public E removeLast()
{
public static void main(String a[])
{
DoublyLinkedListImpl<Integer> dll = new DoublyLinkedListImpl<Integer>();
dll.addFirst(10);
dll.addFirst(34);
dll.addLast(56);
dll.addLast(364);
dll.iterateForward();
dll.removeFirst();
dll.removeLast();
dll.iterateBackward();
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.