SlideShare a Scribd company logo
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.pdf
SIGMATAX1
 
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
ajaycosmeticslg
 
New folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docx
New folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docxNew folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docx
New folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docx
curwenmichaela
 
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
info750646
 
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
VictorXUQGloverl
 
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
shashankbhadouria4
 
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
aromalcom
 
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
aioils
 
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
dbrienmhompsonkath75
 
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
kisgstin23
 
(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
arihantmobileselepun
 
srgoc
srgocsrgoc
Oop2010 Scala Presentation Stal
Oop2010 Scala Presentation StalOop2010 Scala Presentation Stal
Oop2010 Scala Presentation Stal
Michael Stal
 
Queue Data Structure
Queue Data StructureQueue Data Structure
Queue Data Structure
Sriram Raj
 
Queue Data Structure
Queue Data StructureQueue Data Structure
Queue Data Structure
Zidny Nafan
 
Java Generics
Java GenericsJava Generics
Java Generics
jeslie
 
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
 
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
DIPESH30
 
Soundreader.classpathSoundreader.project Soundre.docx
Soundreader.classpathSoundreader.project  Soundre.docxSoundreader.classpathSoundreader.project  Soundre.docx
Soundreader.classpathSoundreader.project Soundre.docx
whitneyleman54422
 
Java Concurrency Gotchas
Java Concurrency GotchasJava Concurrency Gotchas
Java Concurrency Gotchas
Alex 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.pdf
f3apparelsonline
 
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
f3apparelsonline
 
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
f3apparelsonline
 
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
f3apparelsonline
 
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
f3apparelsonline
 
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
f3apparelsonline
 
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
f3apparelsonline
 
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
f3apparelsonline
 
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
f3apparelsonline
 
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
f3apparelsonline
 
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
f3apparelsonline
 
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
f3apparelsonline
 
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
f3apparelsonline
 
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
f3apparelsonline
 
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
f3apparelsonline
 
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
f3apparelsonline
 
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
f3apparelsonline
 
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
f3apparelsonline
 
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
f3apparelsonline
 
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
f3apparelsonline
 

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

Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
Vivekanand Anglo Vedic Academy
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
Jheel Barad
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)
rosedainty
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
bennyroshan06
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
BhavyaRajput3
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS Module
Celine George
 
How to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERPHow to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERP
Celine George
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
Excellence Foundation for South Sudan
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
PedroFerreira53928
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
GeoBlogs
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
MIRIAMSALINAS13
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
EduSkills OECD
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 

Recently uploaded (20)

Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS Module
 
How to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERPHow to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERP
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 

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--;