SlideShare a Scribd company logo
1 of 5
Download to read offline
(1) The goal is to implement DataStructures.ArrayStack according to the interface ADTs.StackADT
********************************************
package DataStructures;
import ADTs.StackADT;
import Exceptions.EmptyCollectionException;
import Exceptions.StackOverflowException;
public class ArrayStack<T> implements StackADT<T> {
/** The index of where the top of the stack is */
int top;
/** The array that holds the stack */
T[] buffer;
public ArrayStack() {
}
public ArrayStack(int initialCapacity) {
}
}
*******************************************************
package ADTs;
import Exceptions.EmptyCollectionException;
import Exceptions.StackOverflowException;
/**
* An interface for a Stack
* Specific stack implementations will implement this interface
* For use Data Structures & Algorithms
*
*
* author unknown
*/
public interface StackADT<T> extends CollectionADT<T> {
/**
* Adds the specified element to the top of the stack
*
* @param element element to be pushed onto the stack
*/
public void push(T element) throws StackOverflowException;
/**
* Removes and returns the element that is on top of the stack
*
* @return the element removed from the stack
* @throws EmptyCollectionException
*/
public T pop() throws EmptyCollectionException;
/**
* Returns (without removing) the element that is on top of the stack
*
* @return the element on top of the stack
* @throws EmptyCollectionException
*/
public T peek() throws EmptyCollectionException;
}
*****************************************
package ADTs;
import Exceptions.*;
/**
* An interface for an ordered (NOT SORTED) List
* Elements stay in the order they are put in to the list
* For use in Data Structures & Algorithms
*
*
* @author unknown
*/
public interface ListADT<T> extends CollectionADT<T> {
/**
* Adds the specified element to the list at the front
*
* @param element: the element to be added
*
*/
public void addFirst(T element);
/**
* Adds the specified element to the end of the list
*
* @param element: the element to be added
*/
public void addLast(T element);
/**
* Adds the specified element to the list after the existing element
*
* @param existing: the element that is in the list already
* @param element: the element to be added
* @throws ElementNotFoundException if existing isn't in the list
*/
public void addAfter(T existing, T element) throws ElementNotFoundException,
EmptyCollectionException;
/**
* Removes and returns the specified element
*
* @return the element specified
* @throws EmptyCollectionException
* @throws ElementNotFoundException
*/
public T remove(T element) throws EmptyCollectionException, ElementNotFoundException;
/**
* Removes and returns the first element
*
* @return the first element in the list
* @throws EmptyCollectionException
*/
public T removeFirst() throws EmptyCollectionException;
/**
* Removes and returns the last element
*
* @return the last element in the list
* @throws EmptyCollectionException
*/
public T removeLast() throws EmptyCollectionException;
/**
* Returns (without removing) the first element in the list
*
* @return element at the beginning of the list
* @throws EmptyCollectionException
*/
public T first() throws EmptyCollectionException;
/**
* Returns (without removing) the last element in the list
*
* @return element at the end of the list
* @throws EmptyCollectionException
*/
public T last() throws EmptyCollectionException;
/**
* Return whether the list contains the given element.
*
* @param element
* @return
* @throws EmptyCollectionException
*/
public boolean contains(T element) throws EmptyCollectionException;
/**
* Returns the index of the given element.
*
* @param element
* @return the index of the element, or -1 if not found
*/
public int indexOf(T element);
/**
* Return the element at the given index of a list.
*
* @param element
* @return
* @throws EmptyCollectionException
*/
public T get(int index) throws EmptyCollectionException, InvalidArgumentException;
/**
* Set the at the given index of a list.
*
* @param element
* @return
* @throws EmptyCollectionException
*/
public void set(int index, T element) throws EmptyCollectionException, InvalidArgumentException;
}
***********************************************
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package ADTs;
/**
* An interface for an AbstractDataType
* Specific ADT interfaces will extend this
* For use in Data Structures & Algorithms
*
*
* @author unknown
*/
public interface CollectionADT<T> {
/**
* Returns true if the collection contains no elements
*
* @return true if the collection is empty
*/
public boolean isEmpty();
/**
* Returns the number of elements in the collection
*
* @return the number of elements as an int
*/
public int size();
/**
* Returns a string representation of the collection
*
* @return a string representation of the collection
*/
@Override
public String toString();
}
**********************************
Project must compile (otherwise no grade)
(1) JavaDoc for DataStructures.ArrayStack class
(2) Tests passing for DataStructures.ArrayStack class

More Related Content

Similar to 1 The goal is to implement DataStructuresArrayStack accor.pdf

Hi,I have added the methods and main class as per your requirement.pdf
Hi,I have added the methods and main class as per your requirement.pdfHi,I have added the methods and main class as per your requirement.pdf
Hi,I have added the methods and main class as per your requirement.pdf
annaelctronics
 
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 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
 
New folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docx
New folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docxNew folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docx
New folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docx
curwenmichaela
 
StackInterface An interface for the ADT stack. Do not modif.pdf
StackInterface An interface for the ADT stack. Do not modif.pdfStackInterface An interface for the ADT stack. Do not modif.pdf
StackInterface An interface for the ADT stack. Do not modif.pdf
ARCHANASTOREKOTA
 
Note- Can someone help me with the public boolean isEmpty()- public bo.pdf
Note- Can someone help me with the public boolean isEmpty()- public bo.pdfNote- Can someone help me with the public boolean isEmpty()- public bo.pdf
Note- Can someone help me with the public boolean isEmpty()- public bo.pdf
Augstore
 
Fix my codeCode.pdf
Fix my codeCode.pdfFix my codeCode.pdf
Fix my codeCode.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
 
So I have this code(StackInAllSocks) and I implemented the method but.pdf
So I have this code(StackInAllSocks) and I implemented the method but.pdfSo I have this code(StackInAllSocks) and I implemented the method but.pdf
So I have this code(StackInAllSocks) and I implemented the method but.pdf
aksahnan
 
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
 
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
 
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
 
LabProgram.javaimport java.util.NoSuchElementException;public .pdf
LabProgram.javaimport java.util.NoSuchElementException;public .pdfLabProgram.javaimport java.util.NoSuchElementException;public .pdf
LabProgram.javaimport java.util.NoSuchElementException;public .pdf
fantasiatheoutofthef
 
@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
 
Implement the interface you wrote for Lab B (EntryWayListInterface)..pdf
Implement the interface you wrote for Lab B (EntryWayListInterface)..pdfImplement the interface you wrote for Lab B (EntryWayListInterface)..pdf
Implement the interface you wrote for Lab B (EntryWayListInterface)..pdf
rishabjain5053
 
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
 
In this lab, we will write an application to store a deck of cards i.pdf
In this lab, we will write an application to store a deck of cards i.pdfIn this lab, we will write an application to store a deck of cards i.pdf
In this lab, we will write an application to store a deck of cards i.pdf
contact41
 
Please help me to make a programming project I have to sue them today- (1).pdf
Please help me to make a programming project I have to sue them today- (1).pdfPlease help me to make a programming project I have to sue them today- (1).pdf
Please help me to make a programming project I have to sue them today- (1).pdf
seoagam1
 

Similar to 1 The goal is to implement DataStructuresArrayStack accor.pdf (20)

Posfix
PosfixPosfix
Posfix
 
Hi,I have added the methods and main class as per your requirement.pdf
Hi,I have added the methods and main class as per your requirement.pdfHi,I have added the methods and main class as per your requirement.pdf
Hi,I have added the methods and main class as per your requirement.pdf
 
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
 
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
 
New folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docx
New folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docxNew folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docx
New folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docx
 
StackInterface An interface for the ADT stack. Do not modif.pdf
StackInterface An interface for the ADT stack. Do not modif.pdfStackInterface An interface for the ADT stack. Do not modif.pdf
StackInterface An interface for the ADT stack. Do not modif.pdf
 
Note- Can someone help me with the public boolean isEmpty()- public bo.pdf
Note- Can someone help me with the public boolean isEmpty()- public bo.pdfNote- Can someone help me with the public boolean isEmpty()- public bo.pdf
Note- Can someone help me with the public boolean isEmpty()- public bo.pdf
 
Fix my codeCode.pdf
Fix my codeCode.pdfFix my codeCode.pdf
Fix my codeCode.pdf
 
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
 
For this lab you will complete the class MyArrayList by implementing.pdf
For this lab you will complete the class MyArrayList by implementing.pdfFor this lab you will complete the class MyArrayList by implementing.pdf
For this lab you will complete the class MyArrayList by implementing.pdf
 
So I have this code(StackInAllSocks) and I implemented the method but.pdf
So I have this code(StackInAllSocks) and I implemented the method but.pdfSo I have this code(StackInAllSocks) and I implemented the method but.pdf
So I have this code(StackInAllSocks) and I implemented the method but.pdf
 
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
 
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
 
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
 
LabProgram.javaimport java.util.NoSuchElementException;public .pdf
LabProgram.javaimport java.util.NoSuchElementException;public .pdfLabProgram.javaimport java.util.NoSuchElementException;public .pdf
LabProgram.javaimport java.util.NoSuchElementException;public .pdf
 
@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
 
Implement the interface you wrote for Lab B (EntryWayListInterface)..pdf
Implement the interface you wrote for Lab B (EntryWayListInterface)..pdfImplement the interface you wrote for Lab B (EntryWayListInterface)..pdf
Implement the interface you wrote for Lab B (EntryWayListInterface)..pdf
 
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
 
In this lab, we will write an application to store a deck of cards i.pdf
In this lab, we will write an application to store a deck of cards i.pdfIn this lab, we will write an application to store a deck of cards i.pdf
In this lab, we will write an application to store a deck of cards i.pdf
 
Please help me to make a programming project I have to sue them today- (1).pdf
Please help me to make a programming project I have to sue them today- (1).pdfPlease help me to make a programming project I have to sue them today- (1).pdf
Please help me to make a programming project I have to sue them today- (1).pdf
 

More from saradashata

Vaka almas eriden 2011 ylnda bir federal jri tannm bir .pdf
Vaka almas eriden 2011 ylnda bir federal jri tannm bir .pdfVaka almas eriden 2011 ylnda bir federal jri tannm bir .pdf
Vaka almas eriden 2011 ylnda bir federal jri tannm bir .pdf
saradashata
 
Tanmlanamayan Sektrler Sonraki iki soruyu cevaplamak iin .pdf
Tanmlanamayan Sektrler  Sonraki iki soruyu cevaplamak iin .pdfTanmlanamayan Sektrler  Sonraki iki soruyu cevaplamak iin .pdf
Tanmlanamayan Sektrler Sonraki iki soruyu cevaplamak iin .pdf
saradashata
 
Please read this case Case Mrs Z is a 70yearold Pakistani.pdf
Please read this case Case Mrs Z is a 70yearold Pakistani.pdfPlease read this case Case Mrs Z is a 70yearold Pakistani.pdf
Please read this case Case Mrs Z is a 70yearold Pakistani.pdf
saradashata
 
Pregunta 4 Qu se entiende por contabilidad creativa Usa.pdf
Pregunta 4   Qu se entiende por contabilidad creativa Usa.pdfPregunta 4   Qu se entiende por contabilidad creativa Usa.pdf
Pregunta 4 Qu se entiende por contabilidad creativa Usa.pdf
saradashata
 

More from saradashata (20)

Which one of the following is NOT one of the four key differ.pdf
Which one of the following is NOT one of the four key differ.pdfWhich one of the following is NOT one of the four key differ.pdf
Which one of the following is NOT one of the four key differ.pdf
 
When you complete the birth certificate workbook develop a .pdf
When you complete the birth certificate workbook develop a .pdfWhen you complete the birth certificate workbook develop a .pdf
When you complete the birth certificate workbook develop a .pdf
 
Wohlers amp Co issued convertible bonds with a face value.pdf
Wohlers amp Co issued convertible bonds with a face value.pdfWohlers amp Co issued convertible bonds with a face value.pdf
Wohlers amp Co issued convertible bonds with a face value.pdf
 
Which of the following describes the respiratory membrane in.pdf
Which of the following describes the respiratory membrane in.pdfWhich of the following describes the respiratory membrane in.pdf
Which of the following describes the respiratory membrane in.pdf
 
Use a commercial passanger airline company to illustrate a s.pdf
Use a commercial passanger airline company to illustrate a s.pdfUse a commercial passanger airline company to illustrate a s.pdf
Use a commercial passanger airline company to illustrate a s.pdf
 
We discussed in class extensively Porters five forces Two.pdf
We discussed in class extensively Porters five forces Two.pdfWe discussed in class extensively Porters five forces Two.pdf
We discussed in class extensively Porters five forces Two.pdf
 
Unilever bir zamanlar ondan fazla farkl amar deterjan marka.pdf
Unilever bir zamanlar ondan fazla farkl amar deterjan marka.pdfUnilever bir zamanlar ondan fazla farkl amar deterjan marka.pdf
Unilever bir zamanlar ondan fazla farkl amar deterjan marka.pdf
 
Use the following Excel payroll register to answer the remai.pdf
Use the following Excel payroll register to answer the remai.pdfUse the following Excel payroll register to answer the remai.pdf
Use the following Excel payroll register to answer the remai.pdf
 
Vaka almas eriden 2011 ylnda bir federal jri tannm bir .pdf
Vaka almas eriden 2011 ylnda bir federal jri tannm bir .pdfVaka almas eriden 2011 ylnda bir federal jri tannm bir .pdf
Vaka almas eriden 2011 ylnda bir federal jri tannm bir .pdf
 
Todo lo siguiente est asociado con la presentacin de infor.pdf
Todo lo siguiente est asociado con la presentacin de infor.pdfTodo lo siguiente est asociado con la presentacin de infor.pdf
Todo lo siguiente est asociado con la presentacin de infor.pdf
 
The mission of The Walt Disney Company is to be one of the w.pdf
The mission of The Walt Disney Company is to be one of the w.pdfThe mission of The Walt Disney Company is to be one of the w.pdf
The mission of The Walt Disney Company is to be one of the w.pdf
 
Segn los autores si una persona hiciera un viaje por carre.pdf
Segn los autores si una persona hiciera un viaje por carre.pdfSegn los autores si una persona hiciera un viaje por carre.pdf
Segn los autores si una persona hiciera un viaje por carre.pdf
 
Tanmlanamayan Sektrler Sonraki iki soruyu cevaplamak iin .pdf
Tanmlanamayan Sektrler  Sonraki iki soruyu cevaplamak iin .pdfTanmlanamayan Sektrler  Sonraki iki soruyu cevaplamak iin .pdf
Tanmlanamayan Sektrler Sonraki iki soruyu cevaplamak iin .pdf
 
Report Topic about The difference between growing aging an.pdf
Report Topic about  The difference between growing aging an.pdfReport Topic about  The difference between growing aging an.pdf
Report Topic about The difference between growing aging an.pdf
 
S 20 alfa 005 1 kuyruk Bo hipotez Madeni para adil .pdf
S  20  alfa  005 1 kuyruk  Bo hipotez Madeni para adil .pdfS  20  alfa  005 1 kuyruk  Bo hipotez Madeni para adil .pdf
S 20 alfa 005 1 kuyruk Bo hipotez Madeni para adil .pdf
 
Please read this case Case Mrs Z is a 70yearold Pakistani.pdf
Please read this case Case Mrs Z is a 70yearold Pakistani.pdfPlease read this case Case Mrs Z is a 70yearold Pakistani.pdf
Please read this case Case Mrs Z is a 70yearold Pakistani.pdf
 
Qu cree que es ms importante el desempeo de la tarea e.pdf
Qu cree que es ms importante el desempeo de la tarea e.pdfQu cree que es ms importante el desempeo de la tarea e.pdf
Qu cree que es ms importante el desempeo de la tarea e.pdf
 
Quito contracts with Rewind Graphix Inc to pay 5000 for.pdf
Quito contracts with Rewind Graphix Inc to pay 5000 for.pdfQuito contracts with Rewind Graphix Inc to pay 5000 for.pdf
Quito contracts with Rewind Graphix Inc to pay 5000 for.pdf
 
Q no 1 Since she was a child Sunita Arora has had an eye f.pdf
Q no 1 Since she was a child Sunita Arora has had an eye f.pdfQ no 1 Since she was a child Sunita Arora has had an eye f.pdf
Q no 1 Since she was a child Sunita Arora has had an eye f.pdf
 
Pregunta 4 Qu se entiende por contabilidad creativa Usa.pdf
Pregunta 4   Qu se entiende por contabilidad creativa Usa.pdfPregunta 4   Qu se entiende por contabilidad creativa Usa.pdf
Pregunta 4 Qu se entiende por contabilidad creativa Usa.pdf
 

Recently uploaded

QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lessonQUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
httgc7rh9c
 

Recently uploaded (20)

OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...
 
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
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17
 
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
 
Tatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf artsTatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf arts
 
21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Model Attribute _rec_name in the Odoo 17
Model Attribute _rec_name in the Odoo 17Model Attribute _rec_name in the Odoo 17
Model Attribute _rec_name in the Odoo 17
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lessonQUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
dusjagr & nano talk on open tools for agriculture research and learning
dusjagr & nano talk on open tools for agriculture research and learningdusjagr & nano talk on open tools for agriculture research and learning
dusjagr & nano talk on open tools for agriculture research and learning
 

1 The goal is to implement DataStructuresArrayStack accor.pdf

  • 1. (1) The goal is to implement DataStructures.ArrayStack according to the interface ADTs.StackADT ******************************************** package DataStructures; import ADTs.StackADT; import Exceptions.EmptyCollectionException; import Exceptions.StackOverflowException; public class ArrayStack<T> implements StackADT<T> { /** The index of where the top of the stack is */ int top; /** The array that holds the stack */ T[] buffer; public ArrayStack() { } public ArrayStack(int initialCapacity) { } } ******************************************************* package ADTs; import Exceptions.EmptyCollectionException; import Exceptions.StackOverflowException; /** * An interface for a Stack * Specific stack implementations will implement this interface * For use Data Structures & Algorithms * * * author unknown */ public interface StackADT<T> extends CollectionADT<T> { /** * Adds the specified element to the top of the stack * * @param element element to be pushed onto the stack */ public void push(T element) throws StackOverflowException; /** * Removes and returns the element that is on top of the stack * * @return the element removed from the stack * @throws EmptyCollectionException */ public T pop() throws EmptyCollectionException;
  • 2. /** * Returns (without removing) the element that is on top of the stack * * @return the element on top of the stack * @throws EmptyCollectionException */ public T peek() throws EmptyCollectionException; } ***************************************** package ADTs; import Exceptions.*; /** * An interface for an ordered (NOT SORTED) List * Elements stay in the order they are put in to the list * For use in Data Structures & Algorithms * * * @author unknown */ public interface ListADT<T> extends CollectionADT<T> { /** * Adds the specified element to the list at the front * * @param element: the element to be added * */ public void addFirst(T element); /** * Adds the specified element to the end of the list * * @param element: the element to be added */ public void addLast(T element); /** * Adds the specified element to the list after the existing element * * @param existing: the element that is in the list already * @param element: the element to be added * @throws ElementNotFoundException if existing isn't in the list */ public void addAfter(T existing, T element) throws ElementNotFoundException, EmptyCollectionException;
  • 3. /** * Removes and returns the specified element * * @return the element specified * @throws EmptyCollectionException * @throws ElementNotFoundException */ public T remove(T element) throws EmptyCollectionException, ElementNotFoundException; /** * Removes and returns the first element * * @return the first element in the list * @throws EmptyCollectionException */ public T removeFirst() throws EmptyCollectionException; /** * Removes and returns the last element * * @return the last element in the list * @throws EmptyCollectionException */ public T removeLast() throws EmptyCollectionException; /** * Returns (without removing) the first element in the list * * @return element at the beginning of the list * @throws EmptyCollectionException */ public T first() throws EmptyCollectionException; /** * Returns (without removing) the last element in the list * * @return element at the end of the list * @throws EmptyCollectionException */ public T last() throws EmptyCollectionException; /** * Return whether the list contains the given element. * * @param element * @return * @throws EmptyCollectionException
  • 4. */ public boolean contains(T element) throws EmptyCollectionException; /** * Returns the index of the given element. * * @param element * @return the index of the element, or -1 if not found */ public int indexOf(T element); /** * Return the element at the given index of a list. * * @param element * @return * @throws EmptyCollectionException */ public T get(int index) throws EmptyCollectionException, InvalidArgumentException; /** * Set the at the given index of a list. * * @param element * @return * @throws EmptyCollectionException */ public void set(int index, T element) throws EmptyCollectionException, InvalidArgumentException; } *********************************************** /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package ADTs; /** * An interface for an AbstractDataType * Specific ADT interfaces will extend this * For use in Data Structures & Algorithms * * * @author unknown */ public interface CollectionADT<T> {
  • 5. /** * Returns true if the collection contains no elements * * @return true if the collection is empty */ public boolean isEmpty(); /** * Returns the number of elements in the collection * * @return the number of elements as an int */ public int size(); /** * Returns a string representation of the collection * * @return a string representation of the collection */ @Override public String toString(); } ********************************** Project must compile (otherwise no grade) (1) JavaDoc for DataStructures.ArrayStack class (2) Tests passing for DataStructures.ArrayStack class