SlideShare a Scribd company logo
1 of 5
Download to read offline
create a new interface called DropoutStackADT for representing a dropout stack. It should
contain exactly the same methods as StackADT, and have documentation for the file and each
method in proper javadoc. Your file will be different from StackADT since a dropout stack acts
differently than a normal stack. When documenting methods that should support throwing an
exception, make a note in its javadocdescription.
Implement a drop-out stack using a linked structure. You use the LinearNode or
LinearDoubleNode classes. Follow the DropoutStackADT interface. See Base_A11Q3.java for a
starting place.
STACKADT
LinearDoubleNode
/**
* Represents a node in a linked list.
*
* @author Java Foundations
* @version 4.0
*/
public class LinearDoubleNode
{
private LinearDoubleNode next,prev;
private T element;
/**
* Creates an empty node.
*/
public LinearDoubleNode()
{
next = null;
element = null;
prev = null;
}
/**
* Creates a node storing the specified element.
* @param elem element to be stored
*/
public LinearDoubleNode(T elem)
{
next = null;
element = elem;
prev = null;
}
/**
* Returns the node that follows this one.
* @return reference to next node
*/
public LinearDoubleNode getNext()
{
return next;
}
/**
* Sets the node that follows this one.
* @param node node to follow this one
*/
public void setNext(LinearDoubleNode node)
{
next = node;
}
/**
* Returns the element stored in this node.
* @return element stored at the node
*/
public T getElement()
{
return element;
}
/**
* Sets the element stored in this node.
* @param elem element to be stored at this node
*/
public void setElement(T elem)
{
element = elem;
}
public LinearDoubleNode getPrev(){
return prev;
}
public void setPrev(LinearDoubleNode node){
prev = node;
}
}
Base File DROP-OUT STACK TESTING The size of the stack is: 4 The stack contains: The size
of the stack is 4 The stack contains:
Solution
public class DropOutStack implements StackADT {
private final int DEFAULT_CAPACITY = 10;
// refers to the item in the array being indexed
private int cIndex;
// holds the count of the stack
private int count;
private T[] stack;
public DropOutStack() {
cIndex = count = 0;
stack = (T[]) (new Object[DEFAULT_CAPACITY]);
}
public DropOutStack(int initialCapacity) {
cIndex = count = 0;
stack = (T[]) (new Object[initialCapacity]);
}
public T peek() throws EmptyCollectionException {
if (isEmpty())
throw new EmptyCollectionException("Drop-out Stack");
return stack[(cIndex + stack.length - 1)%stack.length];
}
public T pop() throws EmptyCollectionException {
if (isEmpty())
throw new EmptyCollectionException("Drop-out Stack");
cIndex = (cIndex + stack.length - 1)%stack.length;
T result = stack[cIndex];
stack[cIndex] = null;
count--;
return result;
}
public void push(T element) {
cIndex = cIndex % stack.length;
stack[cIndex] = element;
cIndex++;
if (count != stack.length)
count++;
}
public int size() {
return count;
}
public boolean isEmpty() {
return size() == 0;
}
public String toString() {
String str = "";
int temp = cIndex;
int length = size();
while(length != 0) {
str += stack[(temp + stack.length - 1)%stack.length] + " ";
temp--;
length--;
}
return str;
}
}

More Related Content

Similar to create a new interface called DropoutStackADT for representing a dro.pdf

Implement the ADT stack by using an array stack to contain its entri.pdf
Implement the ADT stack by using an array stack to contain its entri.pdfImplement the ADT stack by using an array stack to contain its entri.pdf
Implement the ADT stack by using an array stack to contain its entri.pdfSIGMATAX1
 
Please write in C++ and should be able to compile and debug.Thank yo.pdf
Please write in C++ and should be able to compile and debug.Thank yo.pdfPlease write in C++ and should be able to compile and debug.Thank yo.pdf
Please write in C++ and should be able to compile and debug.Thank yo.pdfajaycosmeticslg
 
New folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docx
New folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docxNew folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docx
New folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docxcurwenmichaela
 
Please help write BinaryTree-java Thank you! Create a class BinaryTr.pdf
Please help write BinaryTree-java Thank you!   Create a class BinaryTr.pdfPlease help write BinaryTree-java Thank you!   Create a class BinaryTr.pdf
Please help write BinaryTree-java Thank you! Create a class BinaryTr.pdfinfo750646
 
Java Foundations StackADT-java --- - Defines the interface to a stack.docx
Java Foundations StackADT-java ---  - Defines the interface to a stack.docxJava Foundations StackADT-java ---  - Defines the interface to a stack.docx
Java Foundations StackADT-java --- - Defines the interface to a stack.docxVictorXUQGloverl
 
In java , I want you to implement a Data Structure known as a Doubly.pdf
In java , I want you to implement a Data Structure known as a Doubly.pdfIn java , I want you to implement a Data Structure known as a Doubly.pdf
In java , I want you to implement a Data Structure known as a Doubly.pdfaromalcom
 
please navigate to cs112 webpage and go to assignments -- Trees. Th.pdf
please navigate to cs112 webpage and go to assignments -- Trees. Th.pdfplease navigate to cs112 webpage and go to assignments -- Trees. Th.pdf
please navigate to cs112 webpage and go to assignments -- Trees. Th.pdfaioils
 
java question Fill the add statement areaProject is to wo.pdf
java question Fill the add statement areaProject is to wo.pdfjava question Fill the add statement areaProject is to wo.pdf
java question Fill the add statement areaProject is to wo.pdfdbrienmhompsonkath75
 
A linked stack is implemented using a standard Node class as follows.pdf
A linked stack is implemented using a standard Node class as follows.pdfA linked stack is implemented using a standard Node class as follows.pdf
A linked stack is implemented using a standard Node class as follows.pdfkisgstin23
 
(1)Objective Binary Search Tree traversal (2 points)Use traversal.pdf
(1)Objective Binary Search Tree traversal (2 points)Use traversal.pdf(1)Objective Binary Search Tree traversal (2 points)Use traversal.pdf
(1)Objective Binary Search Tree traversal (2 points)Use traversal.pdfarihantmobileselepun
 
Oop2010 Scala Presentation Stal
Oop2010 Scala Presentation StalOop2010 Scala Presentation Stal
Oop2010 Scala Presentation StalMichael Stal
 
Queue Data Structure
Queue Data StructureQueue Data Structure
Queue Data StructureSriram Raj
 
Queue Data Structure
Queue Data StructureQueue Data Structure
Queue Data StructureZidny Nafan
 
Java Generics
Java GenericsJava Generics
Java Genericsjeslie
 
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 .pdfsiennatimbok52331
 
lab08build.bat@echo offclsset DRIVE_LETTER=1s.docx
lab08build.bat@echo offclsset DRIVE_LETTER=1s.docxlab08build.bat@echo offclsset DRIVE_LETTER=1s.docx
lab08build.bat@echo offclsset DRIVE_LETTER=1s.docxDIPESH30
 
Soundreader.classpathSoundreader.project Soundre.docx
Soundreader.classpathSoundreader.project  Soundre.docxSoundreader.classpathSoundreader.project  Soundre.docx
Soundreader.classpathSoundreader.project Soundre.docxwhitneyleman54422
 
Java Concurrency Gotchas
Java Concurrency GotchasJava Concurrency Gotchas
Java Concurrency GotchasAlex Miller
 

Similar to create a new interface called DropoutStackADT for representing a dro.pdf (20)

Implement the ADT stack by using an array stack to contain its entri.pdf
Implement the ADT stack by using an array stack to contain its entri.pdfImplement the ADT stack by using an array stack to contain its entri.pdf
Implement the ADT stack by using an array stack to contain its entri.pdf
 
Please write in C++ and should be able to compile and debug.Thank yo.pdf
Please write in C++ and should be able to compile and debug.Thank yo.pdfPlease write in C++ and should be able to compile and debug.Thank yo.pdf
Please write in C++ and should be able to compile and debug.Thank yo.pdf
 
New folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docx
New folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docxNew folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docx
New folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docx
 
Please help write BinaryTree-java Thank you! Create a class BinaryTr.pdf
Please help write BinaryTree-java Thank you!   Create a class BinaryTr.pdfPlease help write BinaryTree-java Thank you!   Create a class BinaryTr.pdf
Please help write BinaryTree-java Thank you! Create a class BinaryTr.pdf
 
Java Foundations StackADT-java --- - Defines the interface to a stack.docx
Java Foundations StackADT-java ---  - Defines the interface to a stack.docxJava Foundations StackADT-java ---  - Defines the interface to a stack.docx
Java Foundations StackADT-java --- - Defines the interface to a stack.docx
 
MO 2020 DS Stacks 1 AB.ppt
MO 2020 DS Stacks 1 AB.pptMO 2020 DS Stacks 1 AB.ppt
MO 2020 DS Stacks 1 AB.ppt
 
In java , I want you to implement a Data Structure known as a Doubly.pdf
In java , I want you to implement a Data Structure known as a Doubly.pdfIn java , I want you to implement a Data Structure known as a Doubly.pdf
In java , I want you to implement a Data Structure known as a Doubly.pdf
 
please navigate to cs112 webpage and go to assignments -- Trees. Th.pdf
please navigate to cs112 webpage and go to assignments -- Trees. Th.pdfplease navigate to cs112 webpage and go to assignments -- Trees. Th.pdf
please navigate to cs112 webpage and go to assignments -- Trees. Th.pdf
 
java question Fill the add statement areaProject is to wo.pdf
java question Fill the add statement areaProject is to wo.pdfjava question Fill the add statement areaProject is to wo.pdf
java question Fill the add statement areaProject is to wo.pdf
 
A linked stack is implemented using a standard Node class as follows.pdf
A linked stack is implemented using a standard Node class as follows.pdfA linked stack is implemented using a standard Node class as follows.pdf
A linked stack is implemented using a standard Node class as follows.pdf
 
(1)Objective Binary Search Tree traversal (2 points)Use traversal.pdf
(1)Objective Binary Search Tree traversal (2 points)Use traversal.pdf(1)Objective Binary Search Tree traversal (2 points)Use traversal.pdf
(1)Objective Binary Search Tree traversal (2 points)Use traversal.pdf
 
srgoc
srgocsrgoc
srgoc
 
Oop2010 Scala Presentation Stal
Oop2010 Scala Presentation StalOop2010 Scala Presentation Stal
Oop2010 Scala Presentation Stal
 
Queue Data Structure
Queue Data StructureQueue Data Structure
Queue Data Structure
 
Queue Data Structure
Queue Data StructureQueue Data Structure
Queue Data Structure
 
Java Generics
Java GenericsJava Generics
Java Generics
 
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
 
lab08build.bat@echo offclsset DRIVE_LETTER=1s.docx
lab08build.bat@echo offclsset DRIVE_LETTER=1s.docxlab08build.bat@echo offclsset DRIVE_LETTER=1s.docx
lab08build.bat@echo offclsset DRIVE_LETTER=1s.docx
 
Soundreader.classpathSoundreader.project Soundre.docx
Soundreader.classpathSoundreader.project  Soundre.docxSoundreader.classpathSoundreader.project  Soundre.docx
Soundreader.classpathSoundreader.project Soundre.docx
 
Java Concurrency Gotchas
Java Concurrency GotchasJava Concurrency Gotchas
Java Concurrency Gotchas
 

More from f3apparelsonline

How do the microsporangium and microspore in seed plants differ from.pdf
How do the microsporangium and microspore in seed plants differ from.pdfHow do the microsporangium and microspore in seed plants differ from.pdf
How do the microsporangium and microspore in seed plants differ from.pdff3apparelsonline
 
Homework question with 2 partsA. Compare and contrast the geologic.pdf
Homework question with 2 partsA. Compare and contrast the geologic.pdfHomework question with 2 partsA. Compare and contrast the geologic.pdf
Homework question with 2 partsA. Compare and contrast the geologic.pdff3apparelsonline
 
Client Business Risk The risk that the client will fail to achieve it.pdf
Client Business Risk The risk that the client will fail to achieve it.pdfClient Business Risk The risk that the client will fail to achieve it.pdf
Client Business Risk The risk that the client will fail to achieve it.pdff3apparelsonline
 
Describe how removing water from a hydrophobic binding site or ligan.pdf
Describe how removing water from a hydrophobic binding site or ligan.pdfDescribe how removing water from a hydrophobic binding site or ligan.pdf
Describe how removing water from a hydrophobic binding site or ligan.pdff3apparelsonline
 
Case Project 7-1 commen, diicrerne functions, arii price. wri.pdf
Case Project 7-1 commen, diicrerne functions, arii price. wri.pdfCase Project 7-1 commen, diicrerne functions, arii price. wri.pdf
Case Project 7-1 commen, diicrerne functions, arii price. wri.pdff3apparelsonline
 
Base your answer to questio n 25 on the map below and on your knowled.pdf
Base your answer to questio n 25 on the map below and on your knowled.pdfBase your answer to questio n 25 on the map below and on your knowled.pdf
Base your answer to questio n 25 on the map below and on your knowled.pdff3apparelsonline
 
As presented, the tree summation algorithm was always illustrated wi.pdf
As presented, the tree summation algorithm was always illustrated wi.pdfAs presented, the tree summation algorithm was always illustrated wi.pdf
As presented, the tree summation algorithm was always illustrated wi.pdff3apparelsonline
 
A person who quits a job in Los Angeles to look for work in Chicago i.pdf
A person who quits a job in Los Angeles to look for work in Chicago i.pdfA person who quits a job in Los Angeles to look for work in Chicago i.pdf
A person who quits a job in Los Angeles to look for work in Chicago i.pdff3apparelsonline
 
4. Which one of the following is a key disadvantage of a a. As a gene.pdf
4. Which one of the following is a key disadvantage of a a. As a gene.pdf4. Which one of the following is a key disadvantage of a a. As a gene.pdf
4. Which one of the following is a key disadvantage of a a. As a gene.pdff3apparelsonline
 
Who are the three agencies today that rate bondsHow do the three .pdf
Who are the three agencies today that rate bondsHow do the three .pdfWho are the three agencies today that rate bondsHow do the three .pdf
Who are the three agencies today that rate bondsHow do the three .pdff3apparelsonline
 
Which of the following is trueChimpanzees and hominids share a comm.pdf
Which of the following is trueChimpanzees and hominids share a comm.pdfWhich of the following is trueChimpanzees and hominids share a comm.pdf
Which of the following is trueChimpanzees and hominids share a comm.pdff3apparelsonline
 
What does the multicellular Volvox and unicellular Chlamydomonas sug.pdf
What does the multicellular Volvox and unicellular Chlamydomonas sug.pdfWhat does the multicellular Volvox and unicellular Chlamydomonas sug.pdf
What does the multicellular Volvox and unicellular Chlamydomonas sug.pdff3apparelsonline
 
What is the firm’s cost of preferred stock Please show work in Exce.pdf
What is the firm’s cost of preferred stock Please show work in Exce.pdfWhat is the firm’s cost of preferred stock Please show work in Exce.pdf
What is the firm’s cost of preferred stock Please show work in Exce.pdff3apparelsonline
 
What are the 2 major cytoskeletal classes that participate in cell d.pdf
What are the 2 major cytoskeletal classes that participate in cell d.pdfWhat are the 2 major cytoskeletal classes that participate in cell d.pdf
What are the 2 major cytoskeletal classes that participate in cell d.pdff3apparelsonline
 
Wanda is a 20 percent owner of Video Associates, which is treated as.pdf
Wanda is a 20 percent owner of Video Associates, which is treated as.pdfWanda is a 20 percent owner of Video Associates, which is treated as.pdf
Wanda is a 20 percent owner of Video Associates, which is treated as.pdff3apparelsonline
 
Using Arrays with Sorting and Searching Algorithms1) This program .pdf
Using Arrays with Sorting and Searching Algorithms1) This program .pdfUsing Arrays with Sorting and Searching Algorithms1) This program .pdf
Using Arrays with Sorting and Searching Algorithms1) This program .pdff3apparelsonline
 
Use Java to program the following.1. Create public java class name.pdf
Use Java to program the following.1. Create public java class name.pdfUse Java to program the following.1. Create public java class name.pdf
Use Java to program the following.1. Create public java class name.pdff3apparelsonline
 
To design an expert system, we must first identify a problem to be s.pdf
To design an expert system, we must first identify a problem to be s.pdfTo design an expert system, we must first identify a problem to be s.pdf
To design an expert system, we must first identify a problem to be s.pdff3apparelsonline
 
Translate the following into English. Let C denote an arbitrary coll.pdf
Translate the following into English. Let C denote an arbitrary coll.pdfTranslate the following into English. Let C denote an arbitrary coll.pdf
Translate the following into English. Let C denote an arbitrary coll.pdff3apparelsonline
 
The force on an object is F = - 21j. For the vector v = 2 i - 2j, fin.pdf
The force on an object is F = - 21j. For the vector v = 2 i - 2j, fin.pdfThe force on an object is F = - 21j. For the vector v = 2 i - 2j, fin.pdf
The force on an object is F = - 21j. For the vector v = 2 i - 2j, fin.pdff3apparelsonline
 

More from f3apparelsonline (20)

How do the microsporangium and microspore in seed plants differ from.pdf
How do the microsporangium and microspore in seed plants differ from.pdfHow do the microsporangium and microspore in seed plants differ from.pdf
How do the microsporangium and microspore in seed plants differ from.pdf
 
Homework question with 2 partsA. Compare and contrast the geologic.pdf
Homework question with 2 partsA. Compare and contrast the geologic.pdfHomework question with 2 partsA. Compare and contrast the geologic.pdf
Homework question with 2 partsA. Compare and contrast the geologic.pdf
 
Client Business Risk The risk that the client will fail to achieve it.pdf
Client Business Risk The risk that the client will fail to achieve it.pdfClient Business Risk The risk that the client will fail to achieve it.pdf
Client Business Risk The risk that the client will fail to achieve it.pdf
 
Describe how removing water from a hydrophobic binding site or ligan.pdf
Describe how removing water from a hydrophobic binding site or ligan.pdfDescribe how removing water from a hydrophobic binding site or ligan.pdf
Describe how removing water from a hydrophobic binding site or ligan.pdf
 
Case Project 7-1 commen, diicrerne functions, arii price. wri.pdf
Case Project 7-1 commen, diicrerne functions, arii price. wri.pdfCase Project 7-1 commen, diicrerne functions, arii price. wri.pdf
Case Project 7-1 commen, diicrerne functions, arii price. wri.pdf
 
Base your answer to questio n 25 on the map below and on your knowled.pdf
Base your answer to questio n 25 on the map below and on your knowled.pdfBase your answer to questio n 25 on the map below and on your knowled.pdf
Base your answer to questio n 25 on the map below and on your knowled.pdf
 
As presented, the tree summation algorithm was always illustrated wi.pdf
As presented, the tree summation algorithm was always illustrated wi.pdfAs presented, the tree summation algorithm was always illustrated wi.pdf
As presented, the tree summation algorithm was always illustrated wi.pdf
 
A person who quits a job in Los Angeles to look for work in Chicago i.pdf
A person who quits a job in Los Angeles to look for work in Chicago i.pdfA person who quits a job in Los Angeles to look for work in Chicago i.pdf
A person who quits a job in Los Angeles to look for work in Chicago i.pdf
 
4. Which one of the following is a key disadvantage of a a. As a gene.pdf
4. Which one of the following is a key disadvantage of a a. As a gene.pdf4. Which one of the following is a key disadvantage of a a. As a gene.pdf
4. Which one of the following is a key disadvantage of a a. As a gene.pdf
 
Who are the three agencies today that rate bondsHow do the three .pdf
Who are the three agencies today that rate bondsHow do the three .pdfWho are the three agencies today that rate bondsHow do the three .pdf
Who are the three agencies today that rate bondsHow do the three .pdf
 
Which of the following is trueChimpanzees and hominids share a comm.pdf
Which of the following is trueChimpanzees and hominids share a comm.pdfWhich of the following is trueChimpanzees and hominids share a comm.pdf
Which of the following is trueChimpanzees and hominids share a comm.pdf
 
What does the multicellular Volvox and unicellular Chlamydomonas sug.pdf
What does the multicellular Volvox and unicellular Chlamydomonas sug.pdfWhat does the multicellular Volvox and unicellular Chlamydomonas sug.pdf
What does the multicellular Volvox and unicellular Chlamydomonas sug.pdf
 
What is the firm’s cost of preferred stock Please show work in Exce.pdf
What is the firm’s cost of preferred stock Please show work in Exce.pdfWhat is the firm’s cost of preferred stock Please show work in Exce.pdf
What is the firm’s cost of preferred stock Please show work in Exce.pdf
 
What are the 2 major cytoskeletal classes that participate in cell d.pdf
What are the 2 major cytoskeletal classes that participate in cell d.pdfWhat are the 2 major cytoskeletal classes that participate in cell d.pdf
What are the 2 major cytoskeletal classes that participate in cell d.pdf
 
Wanda is a 20 percent owner of Video Associates, which is treated as.pdf
Wanda is a 20 percent owner of Video Associates, which is treated as.pdfWanda is a 20 percent owner of Video Associates, which is treated as.pdf
Wanda is a 20 percent owner of Video Associates, which is treated as.pdf
 
Using Arrays with Sorting and Searching Algorithms1) This program .pdf
Using Arrays with Sorting and Searching Algorithms1) This program .pdfUsing Arrays with Sorting and Searching Algorithms1) This program .pdf
Using Arrays with Sorting and Searching Algorithms1) This program .pdf
 
Use Java to program the following.1. Create public java class name.pdf
Use Java to program the following.1. Create public java class name.pdfUse Java to program the following.1. Create public java class name.pdf
Use Java to program the following.1. Create public java class name.pdf
 
To design an expert system, we must first identify a problem to be s.pdf
To design an expert system, we must first identify a problem to be s.pdfTo design an expert system, we must first identify a problem to be s.pdf
To design an expert system, we must first identify a problem to be s.pdf
 
Translate the following into English. Let C denote an arbitrary coll.pdf
Translate the following into English. Let C denote an arbitrary coll.pdfTranslate the following into English. Let C denote an arbitrary coll.pdf
Translate the following into English. Let C denote an arbitrary coll.pdf
 
The force on an object is F = - 21j. For the vector v = 2 i - 2j, fin.pdf
The force on an object is F = - 21j. For the vector v = 2 i - 2j, fin.pdfThe force on an object is F = - 21j. For the vector v = 2 i - 2j, fin.pdf
The force on an object is F = - 21j. For the vector v = 2 i - 2j, fin.pdf
 

Recently uploaded

Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - Englishneillewis46
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSCeline George
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxcallscotland1987
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 
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).pptxEsquimalt MFRC
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin ClassesCeline George
 
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
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
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.pdfPoh-Sun Goh
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfNirmal Dwivedi
 
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.christianmathematics
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxVishalSingh1417
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the ClassroomPooky Knightsmith
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxJisc
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
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 functionsKarakKing
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxDr. Sarita Anand
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 

Recently uploaded (20)

Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptx
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
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
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
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...
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
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
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
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.
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
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
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 

create a new interface called DropoutStackADT for representing a dro.pdf

  • 1. create a new interface called DropoutStackADT for representing a dropout stack. It should contain exactly the same methods as StackADT, and have documentation for the file and each method in proper javadoc. Your file will be different from StackADT since a dropout stack acts differently than a normal stack. When documenting methods that should support throwing an exception, make a note in its javadocdescription. Implement a drop-out stack using a linked structure. You use the LinearNode or LinearDoubleNode classes. Follow the DropoutStackADT interface. See Base_A11Q3.java for a starting place. STACKADT LinearDoubleNode /** * Represents a node in a linked list. * * @author Java Foundations * @version 4.0 */ public class LinearDoubleNode { private LinearDoubleNode next,prev; private T element; /** * Creates an empty node. */ public LinearDoubleNode() { next = null; element = null; prev = null; } /** * Creates a node storing the specified element. * @param elem element to be stored */
  • 2. public LinearDoubleNode(T elem) { next = null; element = elem; prev = null; } /** * Returns the node that follows this one. * @return reference to next node */ public LinearDoubleNode getNext() { return next; } /** * Sets the node that follows this one. * @param node node to follow this one */ public void setNext(LinearDoubleNode node) { next = node; } /** * Returns the element stored in this node. * @return element stored at the node */ public T getElement() { return element; } /** * Sets the element stored in this node.
  • 3. * @param elem element to be stored at this node */ public void setElement(T elem) { element = elem; } public LinearDoubleNode getPrev(){ return prev; } public void setPrev(LinearDoubleNode node){ prev = node; } } Base File DROP-OUT STACK TESTING The size of the stack is: 4 The stack contains: The size of the stack is 4 The stack contains: Solution public class DropOutStack implements StackADT { private final int DEFAULT_CAPACITY = 10; // refers to the item in the array being indexed private int cIndex; // holds the count of the stack private int count; private T[] stack; public DropOutStack() { cIndex = count = 0; stack = (T[]) (new Object[DEFAULT_CAPACITY]); } public DropOutStack(int initialCapacity) { cIndex = count = 0;
  • 4. stack = (T[]) (new Object[initialCapacity]); } public T peek() throws EmptyCollectionException { if (isEmpty()) throw new EmptyCollectionException("Drop-out Stack"); return stack[(cIndex + stack.length - 1)%stack.length]; } public T pop() throws EmptyCollectionException { if (isEmpty()) throw new EmptyCollectionException("Drop-out Stack"); cIndex = (cIndex + stack.length - 1)%stack.length; T result = stack[cIndex]; stack[cIndex] = null; count--; return result; } public void push(T element) { cIndex = cIndex % stack.length; stack[cIndex] = element; cIndex++; if (count != stack.length) count++; } public int size() { return count; } public boolean isEmpty() { return size() == 0; } public String toString() { String str = ""; int temp = cIndex; int length = size(); while(length != 0) { str += stack[(temp + stack.length - 1)%stack.length] + " "; temp--;