SlideShare a Scribd company logo
Java Foundations
StackADT.java
/**
* Defines the interface to a stack collection.
*
* @author Java Foundations
* @version 4.0
*/
public interface StackADT<T> {
/**
* Adds the specified element to the top of this stack.
*
* @param element element to be pushed onto the stack
*/
public void push(T element);
/**
* Removes and returns the top element from this stack.
*
* @return the element removed from the stack
* @throws EmptyCollectionException if the stack is empty
*/
public T pop();
/**
* Returns the top element of this stack without removing it from the stack.
*
* @return the element on top of the stack. It is not removed from the stack
* @throws EmptyCollectionException if the stack is empty
*/
public T peek();
/**
* Returns true if this stack contains no elements.
*
* @return true if the stack is empty, false if the stack is not empty
*/
public boolean isEmpty();
/**
* Returns the number of elements in this stack.
*
* @return the number of elements in the stack
*/
public int size();
}
QueueADT.java
/**
* QueueADT defines the interface to a queue collection.
*
* @author Java Foundation
* @version 4.0
*/
public interface QueueADT<T> {
/**
* Adds one element to the rear of this queue.
*
* @param element the element to be added to the rear of the queue
*/
public void enqueue(T element);
/**
* Removes and returns the element at the front of this queue.
*
* @return the element at the front of the queue
* @throws EmptyCollectionException if the queue is empty
*/
public T dequeue();
/**
* Returns without removing the element at the front of this queue.
*
* @return the first element in the queue
* @throws EmptyCollectionException if the queue is empty
*/
public T first();
/**
* Returns true if this queue contains no elements.
*
* @return true if the queue is empty, false if the queue is not empty
*/
public boolean isEmpty();
/**
* Returns the number of elements in this queue.
*
* @return the number of elements in the queue
*/
public int size();
}
LinkedDeque.java
public class LinkedDeque<T> implements QueueADT<T>, StackADT<T>, DequeADT<T> {
// inner class for a double linked list node
private class DNode<T> {
private T element;
private DNode<T> prev, next;
}
// data fields for the LinkedDeque class
private DNode<T> front, rear;
private int size;
// deque interface methods
@Override
public void addFirst(T element) {
// create a new node and set it up
DNode<T> newNode = new DNode<T>();
newNode.element = element; // from param to new node obj
newNode.prev = newNode.next = null;
if(this.isEmpty()) {
// we are making the only node in the deque
this.rear = this.front = newNode;
} else {
// there already exists a new node
// so, put the new node before the front node
newNode.next = this.front;
this.front.prev = newNode;
this.front = newNode;
}
this.size++;
}
@Override
public T removeFirst() {
T grabbedElt = this.getFirst(); // checks for empty for us
if(this.size() == 1) {
// we are removing the only node
// so the deque is becoming empty
} else {
// there are multiple nodes in the queue
// so the rear won't change and we just mess with front end
}
this.size--;
return grabbedElt;
}
@Override
public T getFirst() {
if(this.isEmpty()) {
throw new EmptyCollectionException("LinkedDeque");
}
return this.front.element;
}
@Override
public void addLast(T element) {
}
@Override
public T removeLast() {
return null;
}
@Override
public T getLast() {
if(this.isEmpty()) {
throw new EmptyCollectionException("LinkedDeque");
}
return this.rear.element;
}
// stack interface methods
@Override
public void push(T element) {
this.addFirst(element);
}
@Override
public T pop() {
return this.removeFirst();
}
@Override
public T peek() {
return this.getFirst();
}
// queue interface methods
@Override
public void enqueue(T element) {
// TODO Auto-generated method stub
}
@Override
public T dequeue() {
// TODO Auto-generated method stub
return null;
}
@Override
public T first() {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean isEmpty() {
return (this.size == 0);
}
@Override
public int size() {
return this.size;
}
@Override
public String toString() {
String s = "LinkedDeque of size" + this.size() + "containing (front to back)";
for (DNode <T> curr = this.front; curr != null; curr = curr.next) {
s = s + curr.element;
if(curr.next != null) {
s = s + ", ";
} else {
s = s + ".";
}
}
}
}
EmptyCollectionException.java
/**
* Represents the situation in which a collection is empty.
*
* @author Java Foundations
* @version 4.0
*/
public class EmptyCollectionException extends RuntimeException
{
/**
* Sets up this exception with an appropriate message.
* @param collection the name of the collection
*/
public EmptyCollectionException(String collection)
{
super("The " + collection + " is empty.");
}
}
DequeADT.java
public interface DequeADT<T> {
/**
* The DequeADT (double-ended queue) provides methods for inserting, deleting
* and getting either the first or last element of a sequence of elements.
*/
/**
* Adds a new element to the head of this deque.
*
* @param element the element to insert at the head of this deque
*/
public void addFirst(T element);
/**
* Removes and returns the head element of this deque.
*
* @return the head element of this deque
* @throws EmptyCollectionException if the deque is empty
*/
public T removeFirst();
/**
* @return the head element of this deque
* @throws EmptyCollectionException if the deque is empty
*/
public T getFirst();
/**
* Adds a new element to the tail of this deque.
*
* @param element the element to insert at the tail of this deque
*/
public void addLast(T element);
/**
* Removes and returns the tail element of this deque.
*
* @return the tail element of this deque
* @throws EmptyCollectionException if the deque is empty
*/
public T removeLast();
/**
* @return the tail element of this deque
* @throws EmptyCollectionException if the deque is empty
*/
public T getLast();
/**
* Returns true if this deque contains no elements.
*
* @return true if the deque is empty, false if the deque is not empty
*/
public boolean isEmpty();
/**
* Returns the number of elements in this deque.
*
* @return the number of elements in the deque
*/
public int size();
}
have a toString() method that prints the contents of the data structure on one line. Implementing
multiple interfaces enqueue method should invoke addLast and dequeue should removeFirst).
Make sure to implement every method of all three interfaces. The Main Class You need to have a
Main class that performs the following operations. First, test the DequeADT: - Create a
DequeADT variable for subtype 'String' that contains a LinkedDeque object. - Add 10 items to
the front (all items should be unique, hint use letters ' A ', ' B '), then print the sate of the Deque. -
Remove 5 items from the back (and print the state of the Deque) - Add 5 items to the back (and
print the state of the Deque) - Perform a circular right shift 10 times - A circular right shift means
to remove an from the back, then add that same element to the front - Be sure to print out the
state of the Deque after each shift - Perform a circular left shift 10 times - A circular left shift
means to remove an from the front, then add that same element to the back - Be sure to print out
the state of the Deque after each shift - getLast() to print out the last element Then, use a Deque
as a stack using the StackADT: - Make variable of type 'StackADT', and instantiate it with a
LinkedDeque object - push() 5 elements, print out stack - pop() each element and print it out in a
while loop Then, use a Deque as a queue using the QueueADT: - Make variable of type
'QueueADT, and instantiate it with a LinkedDeque object - enqueue() 5 elements, print out
queue - dequeue( ) an element each element and print it out in a while loop
Ad

More Related Content

Similar to Java Foundations StackADT-java --- - Defines the interface to a stack.docx (20)

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
 
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
 
package ADTs public interface CollectionADTltTgt .pdf
package ADTs public interface CollectionADTltTgt      .pdfpackage ADTs public interface CollectionADTltTgt      .pdf
package ADTs public interface CollectionADTltTgt .pdf
syedabdul78662
 
New folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docx
New folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docxNew folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docx
New folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docx
curwenmichaela
 
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
 
Using NetBeansImplement a queue named QueueLL using a Linked List .pdf
Using NetBeansImplement a queue named QueueLL using a Linked List .pdfUsing NetBeansImplement a queue named QueueLL using a Linked List .pdf
Using NetBeansImplement a queue named QueueLL using a Linked List .pdf
siennatimbok52331
 
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
 
Please complete all the code as per instructions in Java programming.docx
Please complete all the code as per instructions in Java programming.docxPlease complete all the code as per instructions in Java programming.docx
Please complete all the code as per instructions in Java programming.docx
cgraciela1
 
EmptyCollectionException-java -- - Represents the situation in which.docx
EmptyCollectionException-java --  - Represents the situation in which.docxEmptyCollectionException-java --  - Represents the situation in which.docx
EmptyCollectionException-java -- - Represents the situation in which.docx
BlakeSGMHemmingss
 
Posfix
PosfixPosfix
Posfix
Fajar Baskoro
 
Please review my code (java)Someone helped me with it but i cannot.pdf
Please review my code (java)Someone helped me with it but i cannot.pdfPlease review my code (java)Someone helped me with it but i cannot.pdf
Please review my code (java)Someone helped me with it but i cannot.pdf
fathimafancyjeweller
 
For the code below complete the preOrder() method so that it perform.pdf
For the code below complete the preOrder() method so that it perform.pdfFor the code below complete the preOrder() method so that it perform.pdf
For the code below complete the preOrder() method so that it perform.pdf
xlynettalampleyxc
 
Note- Can someone help me with the Public boolean add(E value) method.pdf
Note- Can someone help me with the Public boolean add(E value) method.pdfNote- Can someone help me with the Public boolean add(E value) method.pdf
Note- Can someone help me with the Public boolean add(E value) method.pdf
Stewart29UReesa
 
(674335607) cs2309 java-lab-manual
(674335607) cs2309 java-lab-manual(674335607) cs2309 java-lab-manual
(674335607) cs2309 java-lab-manual
Chandrapriya Jayabal
 
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
 
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
 
Note- Can someone help me with the private E get(int index- int curren (1).docx
Note- Can someone help me with the private E get(int index- int curren (1).docxNote- Can someone help me with the private E get(int index- int curren (1).docx
Note- Can someone help me with the private E get(int index- int curren (1).docx
VictorzH8Bondx
 
I need help implementing a Stack with this java programming assignme.pdf
I need help implementing a Stack with this java programming assignme.pdfI need help implementing a Stack with this java programming assignme.pdf
I need help implementing a Stack with this java programming assignme.pdf
sauravmanwanicp
 
Hi, Please find my code.I have correted all of your classes.Plea.pdf
Hi, Please find my code.I have correted all of your classes.Plea.pdfHi, Please find my code.I have correted all of your classes.Plea.pdf
Hi, Please find my code.I have correted all of your classes.Plea.pdf
pritikulkarni20
 
@author Derek Harter @cwid 123 45 678 @class .docx
@author Derek Harter  @cwid   123 45 678  @class  .docx@author Derek Harter  @cwid   123 45 678  @class  .docx
@author Derek Harter @cwid 123 45 678 @class .docx
adkinspaige22
 
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
 
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
 
package ADTs public interface CollectionADTltTgt .pdf
package ADTs public interface CollectionADTltTgt      .pdfpackage ADTs public interface CollectionADTltTgt      .pdf
package ADTs public interface CollectionADTltTgt .pdf
syedabdul78662
 
New folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docx
New folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docxNew folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docx
New folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docx
curwenmichaela
 
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
 
Using NetBeansImplement a queue named QueueLL using a Linked List .pdf
Using NetBeansImplement a queue named QueueLL using a Linked List .pdfUsing NetBeansImplement a queue named QueueLL using a Linked List .pdf
Using NetBeansImplement a queue named QueueLL using a Linked List .pdf
siennatimbok52331
 
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
 
Please complete all the code as per instructions in Java programming.docx
Please complete all the code as per instructions in Java programming.docxPlease complete all the code as per instructions in Java programming.docx
Please complete all the code as per instructions in Java programming.docx
cgraciela1
 
EmptyCollectionException-java -- - Represents the situation in which.docx
EmptyCollectionException-java --  - Represents the situation in which.docxEmptyCollectionException-java --  - Represents the situation in which.docx
EmptyCollectionException-java -- - Represents the situation in which.docx
BlakeSGMHemmingss
 
Please review my code (java)Someone helped me with it but i cannot.pdf
Please review my code (java)Someone helped me with it but i cannot.pdfPlease review my code (java)Someone helped me with it but i cannot.pdf
Please review my code (java)Someone helped me with it but i cannot.pdf
fathimafancyjeweller
 
For the code below complete the preOrder() method so that it perform.pdf
For the code below complete the preOrder() method so that it perform.pdfFor the code below complete the preOrder() method so that it perform.pdf
For the code below complete the preOrder() method so that it perform.pdf
xlynettalampleyxc
 
Note- Can someone help me with the Public boolean add(E value) method.pdf
Note- Can someone help me with the Public boolean add(E value) method.pdfNote- Can someone help me with the Public boolean add(E value) method.pdf
Note- Can someone help me with the Public boolean add(E value) method.pdf
Stewart29UReesa
 
(674335607) cs2309 java-lab-manual
(674335607) cs2309 java-lab-manual(674335607) cs2309 java-lab-manual
(674335607) cs2309 java-lab-manual
Chandrapriya Jayabal
 
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
 
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
 
Note- Can someone help me with the private E get(int index- int curren (1).docx
Note- Can someone help me with the private E get(int index- int curren (1).docxNote- Can someone help me with the private E get(int index- int curren (1).docx
Note- Can someone help me with the private E get(int index- int curren (1).docx
VictorzH8Bondx
 
I need help implementing a Stack with this java programming assignme.pdf
I need help implementing a Stack with this java programming assignme.pdfI need help implementing a Stack with this java programming assignme.pdf
I need help implementing a Stack with this java programming assignme.pdf
sauravmanwanicp
 
Hi, Please find my code.I have correted all of your classes.Plea.pdf
Hi, Please find my code.I have correted all of your classes.Plea.pdfHi, Please find my code.I have correted all of your classes.Plea.pdf
Hi, Please find my code.I have correted all of your classes.Plea.pdf
pritikulkarni20
 
@author Derek Harter @cwid 123 45 678 @class .docx
@author Derek Harter  @cwid   123 45 678  @class  .docx@author Derek Harter  @cwid   123 45 678  @class  .docx
@author Derek Harter @cwid 123 45 678 @class .docx
adkinspaige22
 

More from VictorXUQGloverl (20)

Look at situations such as radiological- nuclear accidents- technologi.docx
Look at situations such as radiological- nuclear accidents- technologi.docxLook at situations such as radiological- nuclear accidents- technologi.docx
Look at situations such as radiological- nuclear accidents- technologi.docx
VictorXUQGloverl
 
Learning Activity 16-1- Innate Immune Defenses in Different Cases List.docx
Learning Activity 16-1- Innate Immune Defenses in Different Cases List.docxLearning Activity 16-1- Innate Immune Defenses in Different Cases List.docx
Learning Activity 16-1- Innate Immune Defenses in Different Cases List.docx
VictorXUQGloverl
 
List and describe the 5 characteristics of epithelial tissues.docx
List and describe the 5 characteristics of epithelial tissues.docxList and describe the 5 characteristics of epithelial tissues.docx
List and describe the 5 characteristics of epithelial tissues.docx
VictorXUQGloverl
 
LO32 Identify the differences between transcription and translation LO.docx
LO32 Identify the differences between transcription and translation LO.docxLO32 Identify the differences between transcription and translation LO.docx
LO32 Identify the differences between transcription and translation LO.docx
VictorXUQGloverl
 
List + describe the 3 types of skin burns.docx
List + describe the 3 types of skin burns.docxList + describe the 3 types of skin burns.docx
List + describe the 3 types of skin burns.docx
VictorXUQGloverl
 
List and describe the modes of secretion + give examples where used.docx
List and describe the modes of secretion + give examples where used.docxList and describe the modes of secretion + give examples where used.docx
List and describe the modes of secretion + give examples where used.docx
VictorXUQGloverl
 
lim had to give a presentail- Planning phase Analysis phase Design pha.docx
lim had to give a presentail- Planning phase Analysis phase Design pha.docxlim had to give a presentail- Planning phase Analysis phase Design pha.docx
lim had to give a presentail- Planning phase Analysis phase Design pha.docx
VictorXUQGloverl
 
Let- if - the event of cutbres a hat Iet N - the tient of fertre a fec.docx
Let- if - the event of cutbres a hat Iet N - the tient of fertre a fec.docxLet- if - the event of cutbres a hat Iet N - the tient of fertre a fec.docx
Let- if - the event of cutbres a hat Iet N - the tient of fertre a fec.docx
VictorXUQGloverl
 
Let Y be a continuous random variable with density fY- where Y might t.docx
Let Y be a continuous random variable with density fY- where Y might t.docxLet Y be a continuous random variable with density fY- where Y might t.docx
Let Y be a continuous random variable with density fY- where Y might t.docx
VictorXUQGloverl
 
Let X1- - - - - Xn be a random sample from an uniform distribution U(0.docx
Let X1- - - - - Xn be a random sample from an uniform distribution U(0.docxLet X1- - - - - Xn be a random sample from an uniform distribution U(0.docx
Let X1- - - - - Xn be a random sample from an uniform distribution U(0.docx
VictorXUQGloverl
 
Let X be a normal random variable with mean 201 units and standard dev.docx
Let X be a normal random variable with mean 201 units and standard dev.docxLet X be a normal random variable with mean 201 units and standard dev.docx
Let X be a normal random variable with mean 201 units and standard dev.docx
VictorXUQGloverl
 
Let f be a maximum flow on a network G from vertex s to vertex t- and.docx
Let f be a maximum flow on a network G from vertex s to vertex t- and.docxLet f be a maximum flow on a network G from vertex s to vertex t- and.docx
Let f be a maximum flow on a network G from vertex s to vertex t- and.docx
VictorXUQGloverl
 
Leaving an employee alone as long as they are performing satisfactoril.docx
Leaving an employee alone as long as they are performing satisfactoril.docxLeaving an employee alone as long as they are performing satisfactoril.docx
Leaving an employee alone as long as they are performing satisfactoril.docx
VictorXUQGloverl
 
Last question- You conduct the Gram stain on two cultures of a Gram+ o.docx
Last question- You conduct the Gram stain on two cultures of a Gram+ o.docxLast question- You conduct the Gram stain on two cultures of a Gram+ o.docx
Last question- You conduct the Gram stain on two cultures of a Gram+ o.docx
VictorXUQGloverl
 
Label- F BB W T Figure 24-1.docx
Label- F BB W T Figure 24-1.docxLabel- F BB W T Figure 24-1.docx
Label- F BB W T Figure 24-1.docx
VictorXUQGloverl
 
Lab 4-Protists 8- Two silica valves Traits 9- Lobe-shaped pseudopodia.docx
Lab 4-Protists 8- Two silica valves Traits 9- Lobe-shaped pseudopodia.docxLab 4-Protists 8- Two silica valves Traits 9- Lobe-shaped pseudopodia.docx
Lab 4-Protists 8- Two silica valves Traits 9- Lobe-shaped pseudopodia.docx
VictorXUQGloverl
 
John's boss knows that he has taken purchasing courses at Sault Colleg.docx
John's boss knows that he has taken purchasing courses at Sault Colleg.docxJohn's boss knows that he has taken purchasing courses at Sault Colleg.docx
John's boss knows that he has taken purchasing courses at Sault Colleg.docx
VictorXUQGloverl
 
Lab1-3 Step by step algorithm- Assembly implementation fuction- (nuirk.docx
Lab1-3 Step by step algorithm- Assembly implementation fuction- (nuirk.docxLab1-3 Step by step algorithm- Assembly implementation fuction- (nuirk.docx
Lab1-3 Step by step algorithm- Assembly implementation fuction- (nuirk.docx
VictorXUQGloverl
 
Label the following diagram to describe the overall equation of cellul.docx
Label the following diagram to describe the overall equation of cellul.docxLabel the following diagram to describe the overall equation of cellul.docx
Label the following diagram to describe the overall equation of cellul.docx
VictorXUQGloverl
 
Lab 4- Protists Traits 8- Two silica valves 9- Lobe shaped preudopodia.docx
Lab 4- Protists Traits 8- Two silica valves 9- Lobe shaped preudopodia.docxLab 4- Protists Traits 8- Two silica valves 9- Lobe shaped preudopodia.docx
Lab 4- Protists Traits 8- Two silica valves 9- Lobe shaped preudopodia.docx
VictorXUQGloverl
 
Look at situations such as radiological- nuclear accidents- technologi.docx
Look at situations such as radiological- nuclear accidents- technologi.docxLook at situations such as radiological- nuclear accidents- technologi.docx
Look at situations such as radiological- nuclear accidents- technologi.docx
VictorXUQGloverl
 
Learning Activity 16-1- Innate Immune Defenses in Different Cases List.docx
Learning Activity 16-1- Innate Immune Defenses in Different Cases List.docxLearning Activity 16-1- Innate Immune Defenses in Different Cases List.docx
Learning Activity 16-1- Innate Immune Defenses in Different Cases List.docx
VictorXUQGloverl
 
List and describe the 5 characteristics of epithelial tissues.docx
List and describe the 5 characteristics of epithelial tissues.docxList and describe the 5 characteristics of epithelial tissues.docx
List and describe the 5 characteristics of epithelial tissues.docx
VictorXUQGloverl
 
LO32 Identify the differences between transcription and translation LO.docx
LO32 Identify the differences between transcription and translation LO.docxLO32 Identify the differences between transcription and translation LO.docx
LO32 Identify the differences between transcription and translation LO.docx
VictorXUQGloverl
 
List + describe the 3 types of skin burns.docx
List + describe the 3 types of skin burns.docxList + describe the 3 types of skin burns.docx
List + describe the 3 types of skin burns.docx
VictorXUQGloverl
 
List and describe the modes of secretion + give examples where used.docx
List and describe the modes of secretion + give examples where used.docxList and describe the modes of secretion + give examples where used.docx
List and describe the modes of secretion + give examples where used.docx
VictorXUQGloverl
 
lim had to give a presentail- Planning phase Analysis phase Design pha.docx
lim had to give a presentail- Planning phase Analysis phase Design pha.docxlim had to give a presentail- Planning phase Analysis phase Design pha.docx
lim had to give a presentail- Planning phase Analysis phase Design pha.docx
VictorXUQGloverl
 
Let- if - the event of cutbres a hat Iet N - the tient of fertre a fec.docx
Let- if - the event of cutbres a hat Iet N - the tient of fertre a fec.docxLet- if - the event of cutbres a hat Iet N - the tient of fertre a fec.docx
Let- if - the event of cutbres a hat Iet N - the tient of fertre a fec.docx
VictorXUQGloverl
 
Let Y be a continuous random variable with density fY- where Y might t.docx
Let Y be a continuous random variable with density fY- where Y might t.docxLet Y be a continuous random variable with density fY- where Y might t.docx
Let Y be a continuous random variable with density fY- where Y might t.docx
VictorXUQGloverl
 
Let X1- - - - - Xn be a random sample from an uniform distribution U(0.docx
Let X1- - - - - Xn be a random sample from an uniform distribution U(0.docxLet X1- - - - - Xn be a random sample from an uniform distribution U(0.docx
Let X1- - - - - Xn be a random sample from an uniform distribution U(0.docx
VictorXUQGloverl
 
Let X be a normal random variable with mean 201 units and standard dev.docx
Let X be a normal random variable with mean 201 units and standard dev.docxLet X be a normal random variable with mean 201 units and standard dev.docx
Let X be a normal random variable with mean 201 units and standard dev.docx
VictorXUQGloverl
 
Let f be a maximum flow on a network G from vertex s to vertex t- and.docx
Let f be a maximum flow on a network G from vertex s to vertex t- and.docxLet f be a maximum flow on a network G from vertex s to vertex t- and.docx
Let f be a maximum flow on a network G from vertex s to vertex t- and.docx
VictorXUQGloverl
 
Leaving an employee alone as long as they are performing satisfactoril.docx
Leaving an employee alone as long as they are performing satisfactoril.docxLeaving an employee alone as long as they are performing satisfactoril.docx
Leaving an employee alone as long as they are performing satisfactoril.docx
VictorXUQGloverl
 
Last question- You conduct the Gram stain on two cultures of a Gram+ o.docx
Last question- You conduct the Gram stain on two cultures of a Gram+ o.docxLast question- You conduct the Gram stain on two cultures of a Gram+ o.docx
Last question- You conduct the Gram stain on two cultures of a Gram+ o.docx
VictorXUQGloverl
 
Label- F BB W T Figure 24-1.docx
Label- F BB W T Figure 24-1.docxLabel- F BB W T Figure 24-1.docx
Label- F BB W T Figure 24-1.docx
VictorXUQGloverl
 
Lab 4-Protists 8- Two silica valves Traits 9- Lobe-shaped pseudopodia.docx
Lab 4-Protists 8- Two silica valves Traits 9- Lobe-shaped pseudopodia.docxLab 4-Protists 8- Two silica valves Traits 9- Lobe-shaped pseudopodia.docx
Lab 4-Protists 8- Two silica valves Traits 9- Lobe-shaped pseudopodia.docx
VictorXUQGloverl
 
John's boss knows that he has taken purchasing courses at Sault Colleg.docx
John's boss knows that he has taken purchasing courses at Sault Colleg.docxJohn's boss knows that he has taken purchasing courses at Sault Colleg.docx
John's boss knows that he has taken purchasing courses at Sault Colleg.docx
VictorXUQGloverl
 
Lab1-3 Step by step algorithm- Assembly implementation fuction- (nuirk.docx
Lab1-3 Step by step algorithm- Assembly implementation fuction- (nuirk.docxLab1-3 Step by step algorithm- Assembly implementation fuction- (nuirk.docx
Lab1-3 Step by step algorithm- Assembly implementation fuction- (nuirk.docx
VictorXUQGloverl
 
Label the following diagram to describe the overall equation of cellul.docx
Label the following diagram to describe the overall equation of cellul.docxLabel the following diagram to describe the overall equation of cellul.docx
Label the following diagram to describe the overall equation of cellul.docx
VictorXUQGloverl
 
Lab 4- Protists Traits 8- Two silica valves 9- Lobe shaped preudopodia.docx
Lab 4- Protists Traits 8- Two silica valves 9- Lobe shaped preudopodia.docxLab 4- Protists Traits 8- Two silica valves 9- Lobe shaped preudopodia.docx
Lab 4- Protists Traits 8- Two silica valves 9- Lobe shaped preudopodia.docx
VictorXUQGloverl
 
Ad

Recently uploaded (20)

Myopathies (muscle disorders) for undergraduate
Myopathies (muscle disorders) for undergraduateMyopathies (muscle disorders) for undergraduate
Myopathies (muscle disorders) for undergraduate
Mohamed Rizk Khodair
 
MEDICAL BIOLOGY MCQS BY. DR NASIR MUSTAFA
MEDICAL BIOLOGY MCQS  BY. DR NASIR MUSTAFAMEDICAL BIOLOGY MCQS  BY. DR NASIR MUSTAFA
MEDICAL BIOLOGY MCQS BY. DR NASIR MUSTAFA
Dr. Nasir Mustafa
 
Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...
Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...
Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...
parmarjuli1412
 
Classification of mental disorder in 5th semester bsc. nursing and also used ...
Classification of mental disorder in 5th semester bsc. nursing and also used ...Classification of mental disorder in 5th semester bsc. nursing and also used ...
Classification of mental disorder in 5th semester bsc. nursing and also used ...
parmarjuli1412
 
Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...
Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...
Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...
Leonel Morgado
 
Myasthenia gravis (Neuromuscular disorder)
Myasthenia gravis (Neuromuscular disorder)Myasthenia gravis (Neuromuscular disorder)
Myasthenia gravis (Neuromuscular disorder)
Mohamed Rizk Khodair
 
Look Up, Look Down: Spotting Local History Everywhere
Look Up, Look Down: Spotting Local History EverywhereLook Up, Look Down: Spotting Local History Everywhere
Look Up, Look Down: Spotting Local History Everywhere
History of Stoke Newington
 
DEATH & ITS TYPES AND PHYSIOLOGICAL CHANGES IN BODY AFTER DEATH, PATIENT WILL...
DEATH & ITS TYPES AND PHYSIOLOGICAL CHANGES IN BODY AFTER DEATH, PATIENT WILL...DEATH & ITS TYPES AND PHYSIOLOGICAL CHANGES IN BODY AFTER DEATH, PATIENT WILL...
DEATH & ITS TYPES AND PHYSIOLOGICAL CHANGES IN BODY AFTER DEATH, PATIENT WILL...
PoojaSen20
 
Unit 5 ACUTE, SUBACUTE,CHRONIC TOXICITY.pptx
Unit 5 ACUTE, SUBACUTE,CHRONIC TOXICITY.pptxUnit 5 ACUTE, SUBACUTE,CHRONIC TOXICITY.pptx
Unit 5 ACUTE, SUBACUTE,CHRONIC TOXICITY.pptx
Mayuri Chavan
 
How to Configure Extra Steps During Checkout in Odoo 18 Website
How to Configure Extra Steps During Checkout in Odoo 18 WebsiteHow to Configure Extra Steps During Checkout in Odoo 18 Website
How to Configure Extra Steps During Checkout in Odoo 18 Website
Celine George
 
CNS infections (encephalitis, meningitis & Brain abscess
CNS infections (encephalitis, meningitis & Brain abscessCNS infections (encephalitis, meningitis & Brain abscess
CNS infections (encephalitis, meningitis & Brain abscess
Mohamed Rizk Khodair
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 9 THEO ĐƠN VỊ BÀI HỌC - GLOBAL SUCCESS - CẢ NĂM (TỪ...
BÀI TẬP BỔ TRỢ TIẾNG ANH 9 THEO ĐƠN VỊ BÀI HỌC - GLOBAL SUCCESS - CẢ NĂM (TỪ...BÀI TẬP BỔ TRỢ TIẾNG ANH 9 THEO ĐƠN VỊ BÀI HỌC - GLOBAL SUCCESS - CẢ NĂM (TỪ...
BÀI TẬP BỔ TRỢ TIẾNG ANH 9 THEO ĐƠN VỊ BÀI HỌC - GLOBAL SUCCESS - CẢ NĂM (TỪ...
Nguyen Thanh Tu Collection
 
E-Filing_of_Income_Tax.pptx and concept of form 26AS
E-Filing_of_Income_Tax.pptx and concept of form 26ASE-Filing_of_Income_Tax.pptx and concept of form 26AS
E-Filing_of_Income_Tax.pptx and concept of form 26AS
Abinash Palangdar
 
How to Manage Manual Reordering Rule in Odoo 18 Inventory
How to Manage Manual Reordering Rule in Odoo 18 InventoryHow to Manage Manual Reordering Rule in Odoo 18 Inventory
How to Manage Manual Reordering Rule in Odoo 18 Inventory
Celine George
 
puzzle Irregular Verbs- Simple Past Tense
puzzle Irregular Verbs- Simple Past Tensepuzzle Irregular Verbs- Simple Past Tense
puzzle Irregular Verbs- Simple Past Tense
OlgaLeonorTorresSnch
 
Botany Assignment Help Guide - Academic Excellence
Botany Assignment Help Guide - Academic ExcellenceBotany Assignment Help Guide - Academic Excellence
Botany Assignment Help Guide - Academic Excellence
online college homework help
 
Origin of Brahmi script: A breaking down of various theories
Origin of Brahmi script: A breaking down of various theoriesOrigin of Brahmi script: A breaking down of various theories
Origin of Brahmi script: A breaking down of various theories
PrachiSontakke5
 
Chemotherapy of Malignancy -Anticancer.pptx
Chemotherapy of Malignancy -Anticancer.pptxChemotherapy of Malignancy -Anticancer.pptx
Chemotherapy of Malignancy -Anticancer.pptx
Mayuri Chavan
 
COPA Apprentice exam Questions and answers PDF
COPA Apprentice exam Questions and answers PDFCOPA Apprentice exam Questions and answers PDF
COPA Apprentice exam Questions and answers PDF
SONU HEETSON
 
Module 1: Foundations of Research
Module 1: Foundations of ResearchModule 1: Foundations of Research
Module 1: Foundations of Research
drroxannekemp
 
Myopathies (muscle disorders) for undergraduate
Myopathies (muscle disorders) for undergraduateMyopathies (muscle disorders) for undergraduate
Myopathies (muscle disorders) for undergraduate
Mohamed Rizk Khodair
 
MEDICAL BIOLOGY MCQS BY. DR NASIR MUSTAFA
MEDICAL BIOLOGY MCQS  BY. DR NASIR MUSTAFAMEDICAL BIOLOGY MCQS  BY. DR NASIR MUSTAFA
MEDICAL BIOLOGY MCQS BY. DR NASIR MUSTAFA
Dr. Nasir Mustafa
 
Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...
Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...
Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...
parmarjuli1412
 
Classification of mental disorder in 5th semester bsc. nursing and also used ...
Classification of mental disorder in 5th semester bsc. nursing and also used ...Classification of mental disorder in 5th semester bsc. nursing and also used ...
Classification of mental disorder in 5th semester bsc. nursing and also used ...
parmarjuli1412
 
Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...
Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...
Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...
Leonel Morgado
 
Myasthenia gravis (Neuromuscular disorder)
Myasthenia gravis (Neuromuscular disorder)Myasthenia gravis (Neuromuscular disorder)
Myasthenia gravis (Neuromuscular disorder)
Mohamed Rizk Khodair
 
Look Up, Look Down: Spotting Local History Everywhere
Look Up, Look Down: Spotting Local History EverywhereLook Up, Look Down: Spotting Local History Everywhere
Look Up, Look Down: Spotting Local History Everywhere
History of Stoke Newington
 
DEATH & ITS TYPES AND PHYSIOLOGICAL CHANGES IN BODY AFTER DEATH, PATIENT WILL...
DEATH & ITS TYPES AND PHYSIOLOGICAL CHANGES IN BODY AFTER DEATH, PATIENT WILL...DEATH & ITS TYPES AND PHYSIOLOGICAL CHANGES IN BODY AFTER DEATH, PATIENT WILL...
DEATH & ITS TYPES AND PHYSIOLOGICAL CHANGES IN BODY AFTER DEATH, PATIENT WILL...
PoojaSen20
 
Unit 5 ACUTE, SUBACUTE,CHRONIC TOXICITY.pptx
Unit 5 ACUTE, SUBACUTE,CHRONIC TOXICITY.pptxUnit 5 ACUTE, SUBACUTE,CHRONIC TOXICITY.pptx
Unit 5 ACUTE, SUBACUTE,CHRONIC TOXICITY.pptx
Mayuri Chavan
 
How to Configure Extra Steps During Checkout in Odoo 18 Website
How to Configure Extra Steps During Checkout in Odoo 18 WebsiteHow to Configure Extra Steps During Checkout in Odoo 18 Website
How to Configure Extra Steps During Checkout in Odoo 18 Website
Celine George
 
CNS infections (encephalitis, meningitis & Brain abscess
CNS infections (encephalitis, meningitis & Brain abscessCNS infections (encephalitis, meningitis & Brain abscess
CNS infections (encephalitis, meningitis & Brain abscess
Mohamed Rizk Khodair
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 9 THEO ĐƠN VỊ BÀI HỌC - GLOBAL SUCCESS - CẢ NĂM (TỪ...
BÀI TẬP BỔ TRỢ TIẾNG ANH 9 THEO ĐƠN VỊ BÀI HỌC - GLOBAL SUCCESS - CẢ NĂM (TỪ...BÀI TẬP BỔ TRỢ TIẾNG ANH 9 THEO ĐƠN VỊ BÀI HỌC - GLOBAL SUCCESS - CẢ NĂM (TỪ...
BÀI TẬP BỔ TRỢ TIẾNG ANH 9 THEO ĐƠN VỊ BÀI HỌC - GLOBAL SUCCESS - CẢ NĂM (TỪ...
Nguyen Thanh Tu Collection
 
E-Filing_of_Income_Tax.pptx and concept of form 26AS
E-Filing_of_Income_Tax.pptx and concept of form 26ASE-Filing_of_Income_Tax.pptx and concept of form 26AS
E-Filing_of_Income_Tax.pptx and concept of form 26AS
Abinash Palangdar
 
How to Manage Manual Reordering Rule in Odoo 18 Inventory
How to Manage Manual Reordering Rule in Odoo 18 InventoryHow to Manage Manual Reordering Rule in Odoo 18 Inventory
How to Manage Manual Reordering Rule in Odoo 18 Inventory
Celine George
 
puzzle Irregular Verbs- Simple Past Tense
puzzle Irregular Verbs- Simple Past Tensepuzzle Irregular Verbs- Simple Past Tense
puzzle Irregular Verbs- Simple Past Tense
OlgaLeonorTorresSnch
 
Botany Assignment Help Guide - Academic Excellence
Botany Assignment Help Guide - Academic ExcellenceBotany Assignment Help Guide - Academic Excellence
Botany Assignment Help Guide - Academic Excellence
online college homework help
 
Origin of Brahmi script: A breaking down of various theories
Origin of Brahmi script: A breaking down of various theoriesOrigin of Brahmi script: A breaking down of various theories
Origin of Brahmi script: A breaking down of various theories
PrachiSontakke5
 
Chemotherapy of Malignancy -Anticancer.pptx
Chemotherapy of Malignancy -Anticancer.pptxChemotherapy of Malignancy -Anticancer.pptx
Chemotherapy of Malignancy -Anticancer.pptx
Mayuri Chavan
 
COPA Apprentice exam Questions and answers PDF
COPA Apprentice exam Questions and answers PDFCOPA Apprentice exam Questions and answers PDF
COPA Apprentice exam Questions and answers PDF
SONU HEETSON
 
Module 1: Foundations of Research
Module 1: Foundations of ResearchModule 1: Foundations of Research
Module 1: Foundations of Research
drroxannekemp
 
Ad

Java Foundations StackADT-java --- - Defines the interface to a stack.docx

  • 1. Java Foundations StackADT.java /** * Defines the interface to a stack collection. * * @author Java Foundations * @version 4.0 */ public interface StackADT<T> { /** * Adds the specified element to the top of this stack. * * @param element element to be pushed onto the stack */ public void push(T element); /** * Removes and returns the top element from this stack. * * @return the element removed from the stack * @throws EmptyCollectionException if the stack is empty */ public T pop(); /** * Returns the top element of this stack without removing it from the stack. * * @return the element on top of the stack. It is not removed from the stack * @throws EmptyCollectionException if the stack is empty */ public T peek(); /** * Returns true if this stack contains no elements. * * @return true if the stack is empty, false if the stack is not empty */ public boolean isEmpty(); /** * Returns the number of elements in this stack. * * @return the number of elements in the stack
  • 2. */ public int size(); } QueueADT.java /** * QueueADT defines the interface to a queue collection. * * @author Java Foundation * @version 4.0 */ public interface QueueADT<T> { /** * Adds one element to the rear of this queue. * * @param element the element to be added to the rear of the queue */ public void enqueue(T element); /** * Removes and returns the element at the front of this queue. * * @return the element at the front of the queue * @throws EmptyCollectionException if the queue is empty */ public T dequeue(); /** * Returns without removing the element at the front of this queue. * * @return the first element in the queue * @throws EmptyCollectionException if the queue is empty */ public T first(); /** * Returns true if this queue contains no elements. * * @return true if the queue is empty, false if the queue is not empty */ public boolean isEmpty(); /** * Returns the number of elements in this queue. *
  • 3. * @return the number of elements in the queue */ public int size(); } LinkedDeque.java public class LinkedDeque<T> implements QueueADT<T>, StackADT<T>, DequeADT<T> { // inner class for a double linked list node private class DNode<T> { private T element; private DNode<T> prev, next; } // data fields for the LinkedDeque class private DNode<T> front, rear; private int size; // deque interface methods @Override public void addFirst(T element) { // create a new node and set it up DNode<T> newNode = new DNode<T>(); newNode.element = element; // from param to new node obj newNode.prev = newNode.next = null; if(this.isEmpty()) { // we are making the only node in the deque this.rear = this.front = newNode; } else { // there already exists a new node // so, put the new node before the front node newNode.next = this.front; this.front.prev = newNode; this.front = newNode; } this.size++; } @Override public T removeFirst() { T grabbedElt = this.getFirst(); // checks for empty for us
  • 4. if(this.size() == 1) { // we are removing the only node // so the deque is becoming empty } else { // there are multiple nodes in the queue // so the rear won't change and we just mess with front end } this.size--; return grabbedElt; } @Override public T getFirst() { if(this.isEmpty()) { throw new EmptyCollectionException("LinkedDeque"); } return this.front.element; } @Override public void addLast(T element) { } @Override public T removeLast() { return null; } @Override public T getLast() { if(this.isEmpty()) { throw new EmptyCollectionException("LinkedDeque"); } return this.rear.element; } // stack interface methods @Override public void push(T element) {
  • 5. this.addFirst(element); } @Override public T pop() { return this.removeFirst(); } @Override public T peek() { return this.getFirst(); } // queue interface methods @Override public void enqueue(T element) { // TODO Auto-generated method stub } @Override public T dequeue() { // TODO Auto-generated method stub return null; } @Override public T first() { // TODO Auto-generated method stub return null; } @Override public boolean isEmpty() { return (this.size == 0); } @Override public int size() { return this.size; } @Override public String toString() { String s = "LinkedDeque of size" + this.size() + "containing (front to back)";
  • 6. for (DNode <T> curr = this.front; curr != null; curr = curr.next) { s = s + curr.element; if(curr.next != null) { s = s + ", "; } else { s = s + "."; } } } } EmptyCollectionException.java /** * Represents the situation in which a collection is empty. * * @author Java Foundations * @version 4.0 */ public class EmptyCollectionException extends RuntimeException { /** * Sets up this exception with an appropriate message. * @param collection the name of the collection */ public EmptyCollectionException(String collection) { super("The " + collection + " is empty."); } } DequeADT.java public interface DequeADT<T> { /** * The DequeADT (double-ended queue) provides methods for inserting, deleting * and getting either the first or last element of a sequence of elements. */ /** * Adds a new element to the head of this deque. * * @param element the element to insert at the head of this deque */ public void addFirst(T element);
  • 7. /** * Removes and returns the head element of this deque. * * @return the head element of this deque * @throws EmptyCollectionException if the deque is empty */ public T removeFirst(); /** * @return the head element of this deque * @throws EmptyCollectionException if the deque is empty */ public T getFirst(); /** * Adds a new element to the tail of this deque. * * @param element the element to insert at the tail of this deque */ public void addLast(T element); /** * Removes and returns the tail element of this deque. * * @return the tail element of this deque * @throws EmptyCollectionException if the deque is empty */ public T removeLast(); /** * @return the tail element of this deque * @throws EmptyCollectionException if the deque is empty */ public T getLast(); /** * Returns true if this deque contains no elements. * * @return true if the deque is empty, false if the deque is not empty */ public boolean isEmpty(); /** * Returns the number of elements in this deque. * * @return the number of elements in the deque
  • 8. */ public int size(); } have a toString() method that prints the contents of the data structure on one line. Implementing multiple interfaces enqueue method should invoke addLast and dequeue should removeFirst). Make sure to implement every method of all three interfaces. The Main Class You need to have a Main class that performs the following operations. First, test the DequeADT: - Create a DequeADT variable for subtype 'String' that contains a LinkedDeque object. - Add 10 items to the front (all items should be unique, hint use letters ' A ', ' B '), then print the sate of the Deque. - Remove 5 items from the back (and print the state of the Deque) - Add 5 items to the back (and print the state of the Deque) - Perform a circular right shift 10 times - A circular right shift means to remove an from the back, then add that same element to the front - Be sure to print out the state of the Deque after each shift - Perform a circular left shift 10 times - A circular left shift means to remove an from the front, then add that same element to the back - Be sure to print out the state of the Deque after each shift - getLast() to print out the last element Then, use a Deque as a stack using the StackADT: - Make variable of type 'StackADT', and instantiate it with a LinkedDeque object - push() 5 elements, print out stack - pop() each element and print it out in a while loop Then, use a Deque as a queue using the QueueADT: - Make variable of type 'QueueADT, and instantiate it with a LinkedDeque object - enqueue() 5 elements, print out queue - dequeue( ) an element each element and print it out in a while loop
  翻译: