SlideShare uma empresa Scribd logo
1 de 24
Baixar para ler offline
Answer:
Note: Driver class is not given to test the DoubleArraySeq.java
Modified Code:
public class DoubleArraySeq implements Cloneable
{
// Invariant of the DoubleArraySeq class:
// 1. The number of elements in the sequences is in the instance variable
// manyItems.
// 2. For an empty sequence (with no elements), we do not care what is
// stored in any of data; for a non-empty sequence, the elements of the
// sequence are stored in data[0] through data[manyItems-1], and we
// don care what in the rest of data.
// 3. If there is a current element, then it lies in data[currentIndex];
// if there is no current element, then currentIndex equals manyItems.
private double[ ] data;
private int manyItems;
private int currentIndex;
/**
* Initialize an empty sequence with an initial capacity of 10. Note that
* the addAfter and addBefore methods work
* efficiently (without needing more memory) until this capacity is reached.
* @param - none
* @postcondition
* This sequence is empty and has an initial capacity of 10.
* @exception OutOfMemoryError
* Indicates insufficient memory for:
* new double[10].
**/
public DoubleArraySeq( )
{
//Set manyItems to 0.
manyItems=0;
//Initialize data
data=new double[10];
}
/**
* Initialize an empty sequence with a specified initial capacity. Note that
* the addAfter and addBefore methods work
* efficiently (without needing more memory) until this capacity is reached.
* @param initialCapacity
* the initial capacity of this sequence
* @precondition
* initialCapacity is non-negative.
* @postcondition
* This sequence is empty and has the given initial capacity.
* @exception IllegalArgumentException
* Indicates that initialCapacity is negative.
* @exception OutOfMemoryError
* Indicates insufficient memory for:
* new double[initialCapacity].
**/
public DoubleArraySeq(int initialCapacity)
{
//Check initialCapacity. If it is <0, throw EXCEPTION
if(initialCapacity < 0)
//Throw EXCEPTION
throw new IllegalArgumentException ("initialCapacity IS NEGATIVE:");
//Set manyItems to 0.
manyItems = 0;
try
{
data = new double[initialCapacity];
}
catch(OutOfMemoryError ea)
{
throw new RuntimeException
("NOT ENOUGH MEMORY");
}
}
/**
* Add a new element to this sequence, after the current element.
* If the new element would take this sequence beyond its current capacity,
* then the capacity is increased before adding the new element.
* @param element
* the new element that is being added
* @postcondition
* A new copy of the element has been added to this sequence. If there was
* a current element, then the new element is placed after the current
* element. If there was no current element, then the new element is placed
* at the end of the sequence. In all cases, the new element becomes the
* new current element of this sequence.
* @exception OutOfMemoryError
* Indicates insufficient memory for increasing the sequence's capacity.
* @note
* An attempt to increase the capacity beyond
* Integer.MAX_VALUE will cause the sequence to fail with an
* arithmetic overflow.
**/
public void addAfter(double element)
{
//Check the capacity. If array is full, increase its capacity
if(manyItems == data.length)
{
//Increase capacity
ensureCapacity(2*manyItems+1);
}
//If enough space is available for new element
else
{
//If current element exists
if(isCurrent())
{
//Loop to make space
for(int kk = manyItems ;kk > currentIndex+1 ; kk--)
{
data[kk] = data[kk-1];
}
//Insert the new element
data[currentIndex+1] = element;
//Increment the current index
currentIndex +=1;
//Increment the element count
manyItems++;
}
//If current element not present
else{
//Add element at the last
data[manyItems] = element;
//Increment the element count
manyItems++;
}
}
}
/**
* Add a new element to this sequence, before the current element.
* If the new element would take this sequence beyond its current capacity,
* then the capacity is increased before adding the new element.
* @param element
* the new element that is being added
* @postcondition
* A new copy of the element has been added to this sequence. If there was
* a current element, then the new element is placed before the current
* element. If there was no current element, then the new element is placed
* at the start of the sequence. In all cases, the new element becomes the
* new current element of this sequence.
* @exception OutOfMemoryError
* Indicates insufficient memory for increasing the sequence's capacity.
* @note
* An attempt to increase the capacity beyond
* Integer.MAX_VALUE will cause the sequence to fail with an
* arithmetic overflow.
**/
public void addBefore(double element)
{
//Check the capacity. If array is full, increase its capacity
if(manyItems == data.length)
{
ensureCapacity(2*manyItems+1);
}
else
{
//If current element exists
if(isCurrent())
{
//Loop to make space for new element
for(int kk = manyItems ;kk > currentIndex ; kk--)
{
data[kk] = data[kk-1];
}
//Place the new element at the current index
data[currentIndex] = element;
//Increment element counts
manyItems++;
}
//If current element doesn't exist then
else
{
//Loop to move elements
for(int kk = manyItems; kk>0;kk--)
{
data[kk] = data[kk-1];
}
//Place new element at the sequence begining
data[0] = element;
//Increment element counts
manyItems++;
}
}
}
/**
* Place the contents of another sequence at the end of this sequence.
* @param addend
* a sequence whose contents will be placed at the end of this sequence
* @precondition
* The parameter, addend, is not null.
* @postcondition
* The elements from addend have been placed at the end of
* this sequence. The current element of this sequence remains where it
* was, and the addend is also unchanged.
* @exception NullPointerException
* Indicates that addend is null.
* @exception OutOfMemoryError
* Indicates insufficient memory to increase the size of this sequence.
* @note
* An attempt to increase the capacity beyond
* Integer.MAX_VALUE will cause an arithmetic overflow
* that will cause the sequence to fail.
**/
public void addAll(DoubleArraySeq addend)
{
//Ensure the capacity
ensureCapacity(addend.manyItems +manyItems);
//Copy the addend elements
System.arraycopy(addend.data, 0, data, manyItems, addend.manyItems);
//Set the manyItems
manyItems = manyItems + addend.manyItems;
}
/**
* Move forward, so that the current element is now the next element in
* this sequence.
* @param - none
* @precondition
* isCurrent() returns true.
* @postcondition
* If the current element was already the end element of this sequence
* (with nothing after it), then there is no longer any current element.
* Otherwise, the new element is the element immediately after the
* original current element.
* @exception IllegalStateException
* Indicates that there is no current element, so
* advance may not be called.
**/
public void advance( )
{
// If current element exists.
currentIndex +=1;
}
/**
* Generate a copy of this sequence.
* @param - none
* @return
* The return value is a copy of this sequence. Subsequent changes to the
* copy will not affect the original, nor vice versa.
* @exception OutOfMemoryError
* Indicates insufficient memory for creating the clone.
**/
public DoubleArraySeq clone( )
{
// Clone a DoubleArraySeq object.
DoubleArraySeq answer;
try
{
answer = (DoubleArraySeq) super.clone( );
}
catch (CloneNotSupportedException e)
{
// This exception should not occur. But if it does, it would probably
// indicate a programming error that made super.clone unavailable.
// The most common error would be forgetting the "Implements Cloneable"
// clause at the start of this class.
throw new RuntimeException
("This class does not implement Cloneable");
}
answer.data = data.clone( );
return answer;
}
/**
* Create a new sequence that contains all the elements from one sequence
* followed by another.
* @param s1
* the first of two sequences
* @param s2
* the second of two sequences
* @precondition
* Neither s1 nor s2 is null.
* @return
* a new sequence that has the elements of s1 followed by the
* elements of s2 (with no current element)
* @exception NullPointerException.
* Indicates that one of the arguments is null.
* @exception OutOfMemoryError
* Indicates insufficient memory for the new sequence.
* @note
* An attempt to create a sequence with a capacity beyond
* Integer.MAX_VALUE will cause an arithmetic overflow
* that will cause the sequence to fail.
**/
public static DoubleArraySeq concatenation(DoubleArraySeq s1, DoubleArraySeq s2)
{
//Create new DoubleArraySeq with initial capacity to hold s1 and s2 elements
DoubleArraySeq newAry = new DoubleArraySeq(s1.getCapacity()+s2.getCapacity());
//Copy s1 elements
System.arraycopy(s1.data, 0, newAry.data, 0, s1.manyItems);
//Copy s2 elements
System.arraycopy(s2.data, 0, newAry.data, s1.manyItems, s2.manyItems);
//Set manyItems of newAry
newAry.manyItems = s1.manyItems+s2.manyItems;
//Set current element of newAry
newAry.currentIndex = newAry.manyItems;
//return newAry
return newAry;
}
/**
* Change the current capacity of this sequence.
* @param minimumCapacity
* the new capacity for this sequence
* @postcondition
* This sequence's capacity has been changed to at least minimumCapacity.
* If the capacity was already at or greater than minimumCapacity,
* then the capacity is left unchanged.
* @exception OutOfMemoryError
* Indicates insufficient memory for: new int[minimumCapacity].
**/
public void ensureCapacity(int minimumCapacity)
{
//Create a new array
double[] newBigAry;
//Check array's capacity is less than minimumCapacity. //If so, set array's capacity to
minimumCapacity
if(data.length < minimumCapacity)
{
//Initialize new array
newBigAry = new double[minimumCapacity];
//Copy elements into new array
System.arraycopy(data, 0, newBigAry, 0, manyItems);
//Set data to new array
data = newBigAry;
}
}
/**
* Accessor method to get the current capacity of this sequence.
* The add method works efficiently (without needing
* more memory) until this capacity is reached.
* @param - none
* @return
* the current capacity of this sequence
**/
public int getCapacity( )
{
// return the capacity of array
return data.length;
}
/**
* Accessor method to get the current element of this sequence.
* @param - none
* @precondition
* isCurrent() returns true.
* @return
* the current element of this sequence
* @exception IllegalStateException
* Indicates that there is no current element, so
* getCurrent may not be called.
**/
public double getCurrent( )
{
//If current element exists
if(isCurrent())
//Return the current element
return data[currentIndex];
//If current element doesn't exist
else
//throw EXCEPTION
throw new IllegalArgumentException
("no CURRENT ELEMENT");
}
/**
* Accessor method to determine whether this sequence has a specified
* current element that can be retrieved with the
* getCurrent method.
* @param - none
* @return
* true (there is a current element) or false (there is no current element at the moment)
**/
public boolean isCurrent( )
{
//If current element exist
if(currentIndex != manyItems)
//Return true
return true;
//if current element doesnt exist
else{
//Return false.
return false;
}
}
/**
* Remove the current element from this sequence.
* @param - none
* @precondition
* isCurrent() returns true.
* @postcondition
* The current element has been removed from this sequence, and the
* following element (if there is one) is now the new current element.
* If there was no following element, then there is now no current
* element.
* @exception IllegalStateException
* Indicates that there is no current element, so
* removeCurrent may not be called.
**/
public void removeCurrent( )
{
//If current element exists
if(isCurrent())
{
//If current element is the last-element
if(currentIndex == manyItems-1)
{
//Decrease the element count
manyItems -=1;
}
//If current-element is in middle of the sequence
else
{
//Loop to delete the current element by next element
for(int kk= currentIndex;kk
Solution
Answer:
Note: Driver class is not given to test the DoubleArraySeq.java
Modified Code:
public class DoubleArraySeq implements Cloneable
{
// Invariant of the DoubleArraySeq class:
// 1. The number of elements in the sequences is in the instance variable
// manyItems.
// 2. For an empty sequence (with no elements), we do not care what is
// stored in any of data; for a non-empty sequence, the elements of the
// sequence are stored in data[0] through data[manyItems-1], and we
// don care what in the rest of data.
// 3. If there is a current element, then it lies in data[currentIndex];
// if there is no current element, then currentIndex equals manyItems.
private double[ ] data;
private int manyItems;
private int currentIndex;
/**
* Initialize an empty sequence with an initial capacity of 10. Note that
* the addAfter and addBefore methods work
* efficiently (without needing more memory) until this capacity is reached.
* @param - none
* @postcondition
* This sequence is empty and has an initial capacity of 10.
* @exception OutOfMemoryError
* Indicates insufficient memory for:
* new double[10].
**/
public DoubleArraySeq( )
{
//Set manyItems to 0.
manyItems=0;
//Initialize data
data=new double[10];
}
/**
* Initialize an empty sequence with a specified initial capacity. Note that
* the addAfter and addBefore methods work
* efficiently (without needing more memory) until this capacity is reached.
* @param initialCapacity
* the initial capacity of this sequence
* @precondition
* initialCapacity is non-negative.
* @postcondition
* This sequence is empty and has the given initial capacity.
* @exception IllegalArgumentException
* Indicates that initialCapacity is negative.
* @exception OutOfMemoryError
* Indicates insufficient memory for:
* new double[initialCapacity].
**/
public DoubleArraySeq(int initialCapacity)
{
//Check initialCapacity. If it is <0, throw EXCEPTION
if(initialCapacity < 0)
//Throw EXCEPTION
throw new IllegalArgumentException ("initialCapacity IS NEGATIVE:");
//Set manyItems to 0.
manyItems = 0;
try
{
data = new double[initialCapacity];
}
catch(OutOfMemoryError ea)
{
throw new RuntimeException
("NOT ENOUGH MEMORY");
}
}
/**
* Add a new element to this sequence, after the current element.
* If the new element would take this sequence beyond its current capacity,
* then the capacity is increased before adding the new element.
* @param element
* the new element that is being added
* @postcondition
* A new copy of the element has been added to this sequence. If there was
* a current element, then the new element is placed after the current
* element. If there was no current element, then the new element is placed
* at the end of the sequence. In all cases, the new element becomes the
* new current element of this sequence.
* @exception OutOfMemoryError
* Indicates insufficient memory for increasing the sequence's capacity.
* @note
* An attempt to increase the capacity beyond
* Integer.MAX_VALUE will cause the sequence to fail with an
* arithmetic overflow.
**/
public void addAfter(double element)
{
//Check the capacity. If array is full, increase its capacity
if(manyItems == data.length)
{
//Increase capacity
ensureCapacity(2*manyItems+1);
}
//If enough space is available for new element
else
{
//If current element exists
if(isCurrent())
{
//Loop to make space
for(int kk = manyItems ;kk > currentIndex+1 ; kk--)
{
data[kk] = data[kk-1];
}
//Insert the new element
data[currentIndex+1] = element;
//Increment the current index
currentIndex +=1;
//Increment the element count
manyItems++;
}
//If current element not present
else{
//Add element at the last
data[manyItems] = element;
//Increment the element count
manyItems++;
}
}
}
/**
* Add a new element to this sequence, before the current element.
* If the new element would take this sequence beyond its current capacity,
* then the capacity is increased before adding the new element.
* @param element
* the new element that is being added
* @postcondition
* A new copy of the element has been added to this sequence. If there was
* a current element, then the new element is placed before the current
* element. If there was no current element, then the new element is placed
* at the start of the sequence. In all cases, the new element becomes the
* new current element of this sequence.
* @exception OutOfMemoryError
* Indicates insufficient memory for increasing the sequence's capacity.
* @note
* An attempt to increase the capacity beyond
* Integer.MAX_VALUE will cause the sequence to fail with an
* arithmetic overflow.
**/
public void addBefore(double element)
{
//Check the capacity. If array is full, increase its capacity
if(manyItems == data.length)
{
ensureCapacity(2*manyItems+1);
}
else
{
//If current element exists
if(isCurrent())
{
//Loop to make space for new element
for(int kk = manyItems ;kk > currentIndex ; kk--)
{
data[kk] = data[kk-1];
}
//Place the new element at the current index
data[currentIndex] = element;
//Increment element counts
manyItems++;
}
//If current element doesn't exist then
else
{
//Loop to move elements
for(int kk = manyItems; kk>0;kk--)
{
data[kk] = data[kk-1];
}
//Place new element at the sequence begining
data[0] = element;
//Increment element counts
manyItems++;
}
}
}
/**
* Place the contents of another sequence at the end of this sequence.
* @param addend
* a sequence whose contents will be placed at the end of this sequence
* @precondition
* The parameter, addend, is not null.
* @postcondition
* The elements from addend have been placed at the end of
* this sequence. The current element of this sequence remains where it
* was, and the addend is also unchanged.
* @exception NullPointerException
* Indicates that addend is null.
* @exception OutOfMemoryError
* Indicates insufficient memory to increase the size of this sequence.
* @note
* An attempt to increase the capacity beyond
* Integer.MAX_VALUE will cause an arithmetic overflow
* that will cause the sequence to fail.
**/
public void addAll(DoubleArraySeq addend)
{
//Ensure the capacity
ensureCapacity(addend.manyItems +manyItems);
//Copy the addend elements
System.arraycopy(addend.data, 0, data, manyItems, addend.manyItems);
//Set the manyItems
manyItems = manyItems + addend.manyItems;
}
/**
* Move forward, so that the current element is now the next element in
* this sequence.
* @param - none
* @precondition
* isCurrent() returns true.
* @postcondition
* If the current element was already the end element of this sequence
* (with nothing after it), then there is no longer any current element.
* Otherwise, the new element is the element immediately after the
* original current element.
* @exception IllegalStateException
* Indicates that there is no current element, so
* advance may not be called.
**/
public void advance( )
{
// If current element exists.
currentIndex +=1;
}
/**
* Generate a copy of this sequence.
* @param - none
* @return
* The return value is a copy of this sequence. Subsequent changes to the
* copy will not affect the original, nor vice versa.
* @exception OutOfMemoryError
* Indicates insufficient memory for creating the clone.
**/
public DoubleArraySeq clone( )
{
// Clone a DoubleArraySeq object.
DoubleArraySeq answer;
try
{
answer = (DoubleArraySeq) super.clone( );
}
catch (CloneNotSupportedException e)
{
// This exception should not occur. But if it does, it would probably
// indicate a programming error that made super.clone unavailable.
// The most common error would be forgetting the "Implements Cloneable"
// clause at the start of this class.
throw new RuntimeException
("This class does not implement Cloneable");
}
answer.data = data.clone( );
return answer;
}
/**
* Create a new sequence that contains all the elements from one sequence
* followed by another.
* @param s1
* the first of two sequences
* @param s2
* the second of two sequences
* @precondition
* Neither s1 nor s2 is null.
* @return
* a new sequence that has the elements of s1 followed by the
* elements of s2 (with no current element)
* @exception NullPointerException.
* Indicates that one of the arguments is null.
* @exception OutOfMemoryError
* Indicates insufficient memory for the new sequence.
* @note
* An attempt to create a sequence with a capacity beyond
* Integer.MAX_VALUE will cause an arithmetic overflow
* that will cause the sequence to fail.
**/
public static DoubleArraySeq concatenation(DoubleArraySeq s1, DoubleArraySeq s2)
{
//Create new DoubleArraySeq with initial capacity to hold s1 and s2 elements
DoubleArraySeq newAry = new DoubleArraySeq(s1.getCapacity()+s2.getCapacity());
//Copy s1 elements
System.arraycopy(s1.data, 0, newAry.data, 0, s1.manyItems);
//Copy s2 elements
System.arraycopy(s2.data, 0, newAry.data, s1.manyItems, s2.manyItems);
//Set manyItems of newAry
newAry.manyItems = s1.manyItems+s2.manyItems;
//Set current element of newAry
newAry.currentIndex = newAry.manyItems;
//return newAry
return newAry;
}
/**
* Change the current capacity of this sequence.
* @param minimumCapacity
* the new capacity for this sequence
* @postcondition
* This sequence's capacity has been changed to at least minimumCapacity.
* If the capacity was already at or greater than minimumCapacity,
* then the capacity is left unchanged.
* @exception OutOfMemoryError
* Indicates insufficient memory for: new int[minimumCapacity].
**/
public void ensureCapacity(int minimumCapacity)
{
//Create a new array
double[] newBigAry;
//Check array's capacity is less than minimumCapacity. //If so, set array's capacity to
minimumCapacity
if(data.length < minimumCapacity)
{
//Initialize new array
newBigAry = new double[minimumCapacity];
//Copy elements into new array
System.arraycopy(data, 0, newBigAry, 0, manyItems);
//Set data to new array
data = newBigAry;
}
}
/**
* Accessor method to get the current capacity of this sequence.
* The add method works efficiently (without needing
* more memory) until this capacity is reached.
* @param - none
* @return
* the current capacity of this sequence
**/
public int getCapacity( )
{
// return the capacity of array
return data.length;
}
/**
* Accessor method to get the current element of this sequence.
* @param - none
* @precondition
* isCurrent() returns true.
* @return
* the current element of this sequence
* @exception IllegalStateException
* Indicates that there is no current element, so
* getCurrent may not be called.
**/
public double getCurrent( )
{
//If current element exists
if(isCurrent())
//Return the current element
return data[currentIndex];
//If current element doesn't exist
else
//throw EXCEPTION
throw new IllegalArgumentException
("no CURRENT ELEMENT");
}
/**
* Accessor method to determine whether this sequence has a specified
* current element that can be retrieved with the
* getCurrent method.
* @param - none
* @return
* true (there is a current element) or false (there is no current element at the moment)
**/
public boolean isCurrent( )
{
//If current element exist
if(currentIndex != manyItems)
//Return true
return true;
//if current element doesnt exist
else{
//Return false.
return false;
}
}
/**
* Remove the current element from this sequence.
* @param - none
* @precondition
* isCurrent() returns true.
* @postcondition
* The current element has been removed from this sequence, and the
* following element (if there is one) is now the new current element.
* If there was no following element, then there is now no current
* element.
* @exception IllegalStateException
* Indicates that there is no current element, so
* removeCurrent may not be called.
**/
public void removeCurrent( )
{
//If current element exists
if(isCurrent())
{
//If current element is the last-element
if(currentIndex == manyItems-1)
{
//Decrease the element count
manyItems -=1;
}
//If current-element is in middle of the sequence
else
{
//Loop to delete the current element by next element
for(int kk= currentIndex;kk

Mais conteúdo relacionado

Semelhante a AnswerNote Driver class is not given to test the DoubleArraySeq..pdf

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.pdfARCHANASTOREKOTA
 
4. The size of instructions can be fixed or variable. What are advant.pdf
4. The size of instructions can be fixed or variable. What are advant.pdf4. The size of instructions can be fixed or variable. What are advant.pdf
4. The size of instructions can be fixed or variable. What are advant.pdfmumnesh
 
Given the following class in Java- public class ThreeTenDynArray-T- {.pdf
Given the following class in Java-  public class ThreeTenDynArray-T- {.pdfGiven the following class in Java-  public class ThreeTenDynArray-T- {.pdf
Given the following class in Java- public class ThreeTenDynArray-T- {.pdfNicholasflqStewartl
 
@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 .docxadkinspaige22
 
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
 
Queue Data Structure
Queue Data StructureQueue Data Structure
Queue Data StructureZidny Nafan
 
Queue Data Structure
Queue Data StructureQueue Data Structure
Queue Data StructureSriram Raj
 
New folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docx
New folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docxNew folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docx
New folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docxcurwenmichaela
 
I need help in writing the test cases of the below methods i.pdf
I need help in writing the test cases of the below methods i.pdfI need help in writing the test cases of the below methods i.pdf
I need help in writing the test cases of the below methods i.pdfadianantsolutions
 
Everything needs to be according to the instructions- thank you! SUPPO.pdf
Everything needs to be according to the instructions- thank you! SUPPO.pdfEverything needs to be according to the instructions- thank you! SUPPO.pdf
Everything needs to be according to the instructions- thank you! SUPPO.pdffirstchoiceajmer
 
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
 
week4_srcArrayMethods.javaweek4_srcArrayMethods.javapackage ed.docx
week4_srcArrayMethods.javaweek4_srcArrayMethods.javapackage ed.docxweek4_srcArrayMethods.javaweek4_srcArrayMethods.javapackage ed.docx
week4_srcArrayMethods.javaweek4_srcArrayMethods.javapackage ed.docxalanfhall8953
 
Given the following ADT definition of a stack to use stack .docx
Given the following ADT definition of a stack to use stack .docxGiven the following ADT definition of a stack to use stack .docx
Given the following ADT definition of a stack to use stack .docxshericehewat
 
Stack Implementation
Stack ImplementationStack Implementation
Stack ImplementationZidny Nafan
 
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
 
Async task
Async taskAsync task
Async taskLwp Xd
 
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.docxBlakeSGMHemmingss
 
Modifications highlighted in bold lettersDropOutStack.javaim.pdf
Modifications highlighted in bold lettersDropOutStack.javaim.pdfModifications highlighted in bold lettersDropOutStack.javaim.pdf
Modifications highlighted in bold lettersDropOutStack.javaim.pdfLalkamal2
 

Semelhante a AnswerNote Driver class is not given to test the DoubleArraySeq..pdf (20)

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
 
4. The size of instructions can be fixed or variable. What are advant.pdf
4. The size of instructions can be fixed or variable. What are advant.pdf4. The size of instructions can be fixed or variable. What are advant.pdf
4. The size of instructions can be fixed or variable. What are advant.pdf
 
Given the following class in Java- public class ThreeTenDynArray-T- {.pdf
Given the following class in Java-  public class ThreeTenDynArray-T- {.pdfGiven the following class in Java-  public class ThreeTenDynArray-T- {.pdf
Given the following class in Java- public class ThreeTenDynArray-T- {.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
 
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
 
Queue Data Structure
Queue Data StructureQueue Data Structure
Queue Data Structure
 
Queue Data Structure
Queue Data StructureQueue Data Structure
Queue Data Structure
 
7 stacksqueues
7 stacksqueues7 stacksqueues
7 stacksqueues
 
New folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docx
New folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docxNew folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docx
New folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docx
 
I need help in writing the test cases of the below methods i.pdf
I need help in writing the test cases of the below methods i.pdfI need help in writing the test cases of the below methods i.pdf
I need help in writing the test cases of the below methods i.pdf
 
Everything needs to be according to the instructions- thank you! SUPPO.pdf
Everything needs to be according to the instructions- thank you! SUPPO.pdfEverything needs to be according to the instructions- thank you! SUPPO.pdf
Everything needs to be according to the instructions- thank you! SUPPO.pdf
 
강의자료8
강의자료8강의자료8
강의자료8
 
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
 
week4_srcArrayMethods.javaweek4_srcArrayMethods.javapackage ed.docx
week4_srcArrayMethods.javaweek4_srcArrayMethods.javapackage ed.docxweek4_srcArrayMethods.javaweek4_srcArrayMethods.javapackage ed.docx
week4_srcArrayMethods.javaweek4_srcArrayMethods.javapackage ed.docx
 
Given the following ADT definition of a stack to use stack .docx
Given the following ADT definition of a stack to use stack .docxGiven the following ADT definition of a stack to use stack .docx
Given the following ADT definition of a stack to use stack .docx
 
Stack Implementation
Stack ImplementationStack Implementation
Stack Implementation
 
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
 
Async task
Async taskAsync task
Async task
 
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
 
Modifications highlighted in bold lettersDropOutStack.javaim.pdf
Modifications highlighted in bold lettersDropOutStack.javaim.pdfModifications highlighted in bold lettersDropOutStack.javaim.pdf
Modifications highlighted in bold lettersDropOutStack.javaim.pdf
 

Mais de nipuns1983

0.5164Solution0.5164.pdf
0.5164Solution0.5164.pdf0.5164Solution0.5164.pdf
0.5164Solution0.5164.pdfnipuns1983
 
#include stdio.h #include stdlib.h #include unistd.h .pdf
 #include stdio.h #include stdlib.h #include unistd.h .pdf #include stdio.h #include stdlib.h #include unistd.h .pdf
#include stdio.h #include stdlib.h #include unistd.h .pdfnipuns1983
 
Thalamus acts as the gateway to the cerebral cortex. It is situated .pdf
  Thalamus acts as the gateway to the cerebral cortex. It is situated .pdf  Thalamus acts as the gateway to the cerebral cortex. It is situated .pdf
Thalamus acts as the gateway to the cerebral cortex. It is situated .pdfnipuns1983
 
ADH causes increased permeability of DCT and collecting tubule to wa.pdf
  ADH causes increased permeability of DCT and collecting tubule to wa.pdf  ADH causes increased permeability of DCT and collecting tubule to wa.pdf
ADH causes increased permeability of DCT and collecting tubule to wa.pdfnipuns1983
 
There are several solutions for treating chronically mentally ill pa.pdf
There are several solutions for treating chronically mentally ill pa.pdfThere are several solutions for treating chronically mentally ill pa.pdf
There are several solutions for treating chronically mentally ill pa.pdfnipuns1983
 
The water is split providing the electrons for PSII, which then exci.pdf
The water is split providing the electrons for PSII, which then exci.pdfThe water is split providing the electrons for PSII, which then exci.pdf
The water is split providing the electrons for PSII, which then exci.pdfnipuns1983
 
The Sarbanes-Oxlet act (SOX) was primarily enacted following the Enr.pdf
The Sarbanes-Oxlet act (SOX) was primarily enacted following the Enr.pdfThe Sarbanes-Oxlet act (SOX) was primarily enacted following the Enr.pdf
The Sarbanes-Oxlet act (SOX) was primarily enacted following the Enr.pdfnipuns1983
 
The integral has a pole at z=-1Integral region is around a circle .pdf
The integral has a pole at z=-1Integral region is around a circle .pdfThe integral has a pole at z=-1Integral region is around a circle .pdf
The integral has a pole at z=-1Integral region is around a circle .pdfnipuns1983
 
SolutionThis encryption scheme is not considered to be a secure o.pdf
SolutionThis encryption scheme is not considered to be a secure o.pdfSolutionThis encryption scheme is not considered to be a secure o.pdf
SolutionThis encryption scheme is not considered to be a secure o.pdfnipuns1983
 
Smart Beta ia a rather elusive term in modern finance sometimes know.pdf
Smart Beta ia a rather elusive term in modern finance sometimes know.pdfSmart Beta ia a rather elusive term in modern finance sometimes know.pdf
Smart Beta ia a rather elusive term in modern finance sometimes know.pdfnipuns1983
 
Ques-1 What is the differential diagnosis of this patients infectin.pdf
Ques-1 What is the differential diagnosis of this patients infectin.pdfQues-1 What is the differential diagnosis of this patients infectin.pdf
Ques-1 What is the differential diagnosis of this patients infectin.pdfnipuns1983
 
package employeeType.employee;public abstract class Employee {  .pdf
package employeeType.employee;public abstract class Employee {  .pdfpackage employeeType.employee;public abstract class Employee {  .pdf
package employeeType.employee;public abstract class Employee {  .pdfnipuns1983
 
Option 1Project management software Project management software .pdf
Option 1Project management software Project management software .pdfOption 1Project management software Project management software .pdf
Option 1Project management software Project management software .pdfnipuns1983
 
import java.util.Scanner;public class InputIntegers{public sta.pdf
import java.util.Scanner;public class InputIntegers{public sta.pdfimport java.util.Scanner;public class InputIntegers{public sta.pdf
import java.util.Scanner;public class InputIntegers{public sta.pdfnipuns1983
 
The main drawback of Troutons rule is that it i.pdf
                     The main drawback of Troutons rule is that it i.pdf                     The main drawback of Troutons rule is that it i.pdf
The main drawback of Troutons rule is that it i.pdfnipuns1983
 
Solid to liquid, or liquid to gas change absorbs .pdf
                     Solid to liquid, or liquid to gas change absorbs .pdf                     Solid to liquid, or liquid to gas change absorbs .pdf
Solid to liquid, or liquid to gas change absorbs .pdfnipuns1983
 
RNase P catalyzes the Mg2+-dependent 5-maturati.pdf
                     RNase P catalyzes the Mg2+-dependent 5-maturati.pdf                     RNase P catalyzes the Mg2+-dependent 5-maturati.pdf
RNase P catalyzes the Mg2+-dependent 5-maturati.pdfnipuns1983
 
pH of a solution is directly proportional to mola.pdf
                     pH of a solution is directly proportional to mola.pdf                     pH of a solution is directly proportional to mola.pdf
pH of a solution is directly proportional to mola.pdfnipuns1983
 
Option - D is correct !! .pdf
                     Option - D is correct !!                         .pdf                     Option - D is correct !!                         .pdf
Option - D is correct !! .pdfnipuns1983
 
n = number present before orbital =3 l= 0 for s, .pdf
                     n = number present before orbital =3 l= 0 for s, .pdf                     n = number present before orbital =3 l= 0 for s, .pdf
n = number present before orbital =3 l= 0 for s, .pdfnipuns1983
 

Mais de nipuns1983 (20)

0.5164Solution0.5164.pdf
0.5164Solution0.5164.pdf0.5164Solution0.5164.pdf
0.5164Solution0.5164.pdf
 
#include stdio.h #include stdlib.h #include unistd.h .pdf
 #include stdio.h #include stdlib.h #include unistd.h .pdf #include stdio.h #include stdlib.h #include unistd.h .pdf
#include stdio.h #include stdlib.h #include unistd.h .pdf
 
Thalamus acts as the gateway to the cerebral cortex. It is situated .pdf
  Thalamus acts as the gateway to the cerebral cortex. It is situated .pdf  Thalamus acts as the gateway to the cerebral cortex. It is situated .pdf
Thalamus acts as the gateway to the cerebral cortex. It is situated .pdf
 
ADH causes increased permeability of DCT and collecting tubule to wa.pdf
  ADH causes increased permeability of DCT and collecting tubule to wa.pdf  ADH causes increased permeability of DCT and collecting tubule to wa.pdf
ADH causes increased permeability of DCT and collecting tubule to wa.pdf
 
There are several solutions for treating chronically mentally ill pa.pdf
There are several solutions for treating chronically mentally ill pa.pdfThere are several solutions for treating chronically mentally ill pa.pdf
There are several solutions for treating chronically mentally ill pa.pdf
 
The water is split providing the electrons for PSII, which then exci.pdf
The water is split providing the electrons for PSII, which then exci.pdfThe water is split providing the electrons for PSII, which then exci.pdf
The water is split providing the electrons for PSII, which then exci.pdf
 
The Sarbanes-Oxlet act (SOX) was primarily enacted following the Enr.pdf
The Sarbanes-Oxlet act (SOX) was primarily enacted following the Enr.pdfThe Sarbanes-Oxlet act (SOX) was primarily enacted following the Enr.pdf
The Sarbanes-Oxlet act (SOX) was primarily enacted following the Enr.pdf
 
The integral has a pole at z=-1Integral region is around a circle .pdf
The integral has a pole at z=-1Integral region is around a circle .pdfThe integral has a pole at z=-1Integral region is around a circle .pdf
The integral has a pole at z=-1Integral region is around a circle .pdf
 
SolutionThis encryption scheme is not considered to be a secure o.pdf
SolutionThis encryption scheme is not considered to be a secure o.pdfSolutionThis encryption scheme is not considered to be a secure o.pdf
SolutionThis encryption scheme is not considered to be a secure o.pdf
 
Smart Beta ia a rather elusive term in modern finance sometimes know.pdf
Smart Beta ia a rather elusive term in modern finance sometimes know.pdfSmart Beta ia a rather elusive term in modern finance sometimes know.pdf
Smart Beta ia a rather elusive term in modern finance sometimes know.pdf
 
Ques-1 What is the differential diagnosis of this patients infectin.pdf
Ques-1 What is the differential diagnosis of this patients infectin.pdfQues-1 What is the differential diagnosis of this patients infectin.pdf
Ques-1 What is the differential diagnosis of this patients infectin.pdf
 
package employeeType.employee;public abstract class Employee {  .pdf
package employeeType.employee;public abstract class Employee {  .pdfpackage employeeType.employee;public abstract class Employee {  .pdf
package employeeType.employee;public abstract class Employee {  .pdf
 
Option 1Project management software Project management software .pdf
Option 1Project management software Project management software .pdfOption 1Project management software Project management software .pdf
Option 1Project management software Project management software .pdf
 
import java.util.Scanner;public class InputIntegers{public sta.pdf
import java.util.Scanner;public class InputIntegers{public sta.pdfimport java.util.Scanner;public class InputIntegers{public sta.pdf
import java.util.Scanner;public class InputIntegers{public sta.pdf
 
The main drawback of Troutons rule is that it i.pdf
                     The main drawback of Troutons rule is that it i.pdf                     The main drawback of Troutons rule is that it i.pdf
The main drawback of Troutons rule is that it i.pdf
 
Solid to liquid, or liquid to gas change absorbs .pdf
                     Solid to liquid, or liquid to gas change absorbs .pdf                     Solid to liquid, or liquid to gas change absorbs .pdf
Solid to liquid, or liquid to gas change absorbs .pdf
 
RNase P catalyzes the Mg2+-dependent 5-maturati.pdf
                     RNase P catalyzes the Mg2+-dependent 5-maturati.pdf                     RNase P catalyzes the Mg2+-dependent 5-maturati.pdf
RNase P catalyzes the Mg2+-dependent 5-maturati.pdf
 
pH of a solution is directly proportional to mola.pdf
                     pH of a solution is directly proportional to mola.pdf                     pH of a solution is directly proportional to mola.pdf
pH of a solution is directly proportional to mola.pdf
 
Option - D is correct !! .pdf
                     Option - D is correct !!                         .pdf                     Option - D is correct !!                         .pdf
Option - D is correct !! .pdf
 
n = number present before orbital =3 l= 0 for s, .pdf
                     n = number present before orbital =3 l= 0 for s, .pdf                     n = number present before orbital =3 l= 0 for s, .pdf
n = number present before orbital =3 l= 0 for s, .pdf
 

Último

Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024Janet Corral
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfAyushMahapatra5
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...PsychoTech Services
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajanpragatimahajan3
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 

Último (20)

Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 

AnswerNote Driver class is not given to test the DoubleArraySeq..pdf

  • 1. Answer: Note: Driver class is not given to test the DoubleArraySeq.java Modified Code: public class DoubleArraySeq implements Cloneable { // Invariant of the DoubleArraySeq class: // 1. The number of elements in the sequences is in the instance variable // manyItems. // 2. For an empty sequence (with no elements), we do not care what is // stored in any of data; for a non-empty sequence, the elements of the // sequence are stored in data[0] through data[manyItems-1], and we // don care what in the rest of data. // 3. If there is a current element, then it lies in data[currentIndex]; // if there is no current element, then currentIndex equals manyItems. private double[ ] data; private int manyItems; private int currentIndex; /** * Initialize an empty sequence with an initial capacity of 10. Note that * the addAfter and addBefore methods work * efficiently (without needing more memory) until this capacity is reached. * @param - none * @postcondition * This sequence is empty and has an initial capacity of 10. * @exception OutOfMemoryError * Indicates insufficient memory for: * new double[10]. **/ public DoubleArraySeq( ) { //Set manyItems to 0. manyItems=0; //Initialize data data=new double[10];
  • 2. } /** * Initialize an empty sequence with a specified initial capacity. Note that * the addAfter and addBefore methods work * efficiently (without needing more memory) until this capacity is reached. * @param initialCapacity * the initial capacity of this sequence * @precondition * initialCapacity is non-negative. * @postcondition * This sequence is empty and has the given initial capacity. * @exception IllegalArgumentException * Indicates that initialCapacity is negative. * @exception OutOfMemoryError * Indicates insufficient memory for: * new double[initialCapacity]. **/ public DoubleArraySeq(int initialCapacity) { //Check initialCapacity. If it is <0, throw EXCEPTION if(initialCapacity < 0) //Throw EXCEPTION throw new IllegalArgumentException ("initialCapacity IS NEGATIVE:"); //Set manyItems to 0. manyItems = 0; try { data = new double[initialCapacity]; } catch(OutOfMemoryError ea) { throw new RuntimeException ("NOT ENOUGH MEMORY"); } }
  • 3. /** * Add a new element to this sequence, after the current element. * If the new element would take this sequence beyond its current capacity, * then the capacity is increased before adding the new element. * @param element * the new element that is being added * @postcondition * A new copy of the element has been added to this sequence. If there was * a current element, then the new element is placed after the current * element. If there was no current element, then the new element is placed * at the end of the sequence. In all cases, the new element becomes the * new current element of this sequence. * @exception OutOfMemoryError * Indicates insufficient memory for increasing the sequence's capacity. * @note * An attempt to increase the capacity beyond * Integer.MAX_VALUE will cause the sequence to fail with an * arithmetic overflow. **/ public void addAfter(double element) { //Check the capacity. If array is full, increase its capacity if(manyItems == data.length) { //Increase capacity ensureCapacity(2*manyItems+1); } //If enough space is available for new element else { //If current element exists if(isCurrent()) { //Loop to make space
  • 4. for(int kk = manyItems ;kk > currentIndex+1 ; kk--) { data[kk] = data[kk-1]; } //Insert the new element data[currentIndex+1] = element; //Increment the current index currentIndex +=1; //Increment the element count manyItems++; } //If current element not present else{ //Add element at the last data[manyItems] = element; //Increment the element count manyItems++; } } } /** * Add a new element to this sequence, before the current element. * If the new element would take this sequence beyond its current capacity, * then the capacity is increased before adding the new element. * @param element * the new element that is being added * @postcondition * A new copy of the element has been added to this sequence. If there was * a current element, then the new element is placed before the current * element. If there was no current element, then the new element is placed * at the start of the sequence. In all cases, the new element becomes the * new current element of this sequence. * @exception OutOfMemoryError * Indicates insufficient memory for increasing the sequence's capacity. * @note * An attempt to increase the capacity beyond
  • 5. * Integer.MAX_VALUE will cause the sequence to fail with an * arithmetic overflow. **/ public void addBefore(double element) { //Check the capacity. If array is full, increase its capacity if(manyItems == data.length) { ensureCapacity(2*manyItems+1); } else { //If current element exists if(isCurrent()) { //Loop to make space for new element for(int kk = manyItems ;kk > currentIndex ; kk--) { data[kk] = data[kk-1]; } //Place the new element at the current index data[currentIndex] = element; //Increment element counts manyItems++; } //If current element doesn't exist then else { //Loop to move elements for(int kk = manyItems; kk>0;kk--) { data[kk] = data[kk-1]; } //Place new element at the sequence begining data[0] = element; //Increment element counts
  • 6. manyItems++; } } } /** * Place the contents of another sequence at the end of this sequence. * @param addend * a sequence whose contents will be placed at the end of this sequence * @precondition * The parameter, addend, is not null. * @postcondition * The elements from addend have been placed at the end of * this sequence. The current element of this sequence remains where it * was, and the addend is also unchanged. * @exception NullPointerException * Indicates that addend is null. * @exception OutOfMemoryError * Indicates insufficient memory to increase the size of this sequence. * @note * An attempt to increase the capacity beyond * Integer.MAX_VALUE will cause an arithmetic overflow * that will cause the sequence to fail. **/ public void addAll(DoubleArraySeq addend) { //Ensure the capacity ensureCapacity(addend.manyItems +manyItems); //Copy the addend elements System.arraycopy(addend.data, 0, data, manyItems, addend.manyItems); //Set the manyItems manyItems = manyItems + addend.manyItems; }
  • 7. /** * Move forward, so that the current element is now the next element in * this sequence. * @param - none * @precondition * isCurrent() returns true. * @postcondition * If the current element was already the end element of this sequence * (with nothing after it), then there is no longer any current element. * Otherwise, the new element is the element immediately after the * original current element. * @exception IllegalStateException * Indicates that there is no current element, so * advance may not be called. **/ public void advance( ) { // If current element exists. currentIndex +=1; } /** * Generate a copy of this sequence. * @param - none * @return * The return value is a copy of this sequence. Subsequent changes to the * copy will not affect the original, nor vice versa. * @exception OutOfMemoryError * Indicates insufficient memory for creating the clone. **/ public DoubleArraySeq clone( ) { // Clone a DoubleArraySeq object. DoubleArraySeq answer;
  • 8. try { answer = (DoubleArraySeq) super.clone( ); } catch (CloneNotSupportedException e) { // This exception should not occur. But if it does, it would probably // indicate a programming error that made super.clone unavailable. // The most common error would be forgetting the "Implements Cloneable" // clause at the start of this class. throw new RuntimeException ("This class does not implement Cloneable"); } answer.data = data.clone( ); return answer; } /** * Create a new sequence that contains all the elements from one sequence * followed by another. * @param s1 * the first of two sequences * @param s2 * the second of two sequences * @precondition * Neither s1 nor s2 is null. * @return * a new sequence that has the elements of s1 followed by the * elements of s2 (with no current element) * @exception NullPointerException. * Indicates that one of the arguments is null. * @exception OutOfMemoryError * Indicates insufficient memory for the new sequence. * @note
  • 9. * An attempt to create a sequence with a capacity beyond * Integer.MAX_VALUE will cause an arithmetic overflow * that will cause the sequence to fail. **/ public static DoubleArraySeq concatenation(DoubleArraySeq s1, DoubleArraySeq s2) { //Create new DoubleArraySeq with initial capacity to hold s1 and s2 elements DoubleArraySeq newAry = new DoubleArraySeq(s1.getCapacity()+s2.getCapacity()); //Copy s1 elements System.arraycopy(s1.data, 0, newAry.data, 0, s1.manyItems); //Copy s2 elements System.arraycopy(s2.data, 0, newAry.data, s1.manyItems, s2.manyItems); //Set manyItems of newAry newAry.manyItems = s1.manyItems+s2.manyItems; //Set current element of newAry newAry.currentIndex = newAry.manyItems; //return newAry return newAry; } /** * Change the current capacity of this sequence. * @param minimumCapacity * the new capacity for this sequence * @postcondition * This sequence's capacity has been changed to at least minimumCapacity. * If the capacity was already at or greater than minimumCapacity, * then the capacity is left unchanged. * @exception OutOfMemoryError * Indicates insufficient memory for: new int[minimumCapacity]. **/ public void ensureCapacity(int minimumCapacity) { //Create a new array double[] newBigAry; //Check array's capacity is less than minimumCapacity. //If so, set array's capacity to minimumCapacity
  • 10. if(data.length < minimumCapacity) { //Initialize new array newBigAry = new double[minimumCapacity]; //Copy elements into new array System.arraycopy(data, 0, newBigAry, 0, manyItems); //Set data to new array data = newBigAry; } } /** * Accessor method to get the current capacity of this sequence. * The add method works efficiently (without needing * more memory) until this capacity is reached. * @param - none * @return * the current capacity of this sequence **/ public int getCapacity( ) { // return the capacity of array return data.length; } /** * Accessor method to get the current element of this sequence. * @param - none * @precondition * isCurrent() returns true. * @return * the current element of this sequence * @exception IllegalStateException * Indicates that there is no current element, so * getCurrent may not be called. **/ public double getCurrent( )
  • 11. { //If current element exists if(isCurrent()) //Return the current element return data[currentIndex]; //If current element doesn't exist else //throw EXCEPTION throw new IllegalArgumentException ("no CURRENT ELEMENT"); } /** * Accessor method to determine whether this sequence has a specified * current element that can be retrieved with the * getCurrent method. * @param - none * @return * true (there is a current element) or false (there is no current element at the moment) **/ public boolean isCurrent( ) { //If current element exist if(currentIndex != manyItems) //Return true return true; //if current element doesnt exist else{ //Return false. return false; } } /** * Remove the current element from this sequence. * @param - none * @precondition
  • 12. * isCurrent() returns true. * @postcondition * The current element has been removed from this sequence, and the * following element (if there is one) is now the new current element. * If there was no following element, then there is now no current * element. * @exception IllegalStateException * Indicates that there is no current element, so * removeCurrent may not be called. **/ public void removeCurrent( ) { //If current element exists if(isCurrent()) { //If current element is the last-element if(currentIndex == manyItems-1) { //Decrease the element count manyItems -=1; } //If current-element is in middle of the sequence else { //Loop to delete the current element by next element for(int kk= currentIndex;kk Solution Answer: Note: Driver class is not given to test the DoubleArraySeq.java Modified Code: public class DoubleArraySeq implements Cloneable { // Invariant of the DoubleArraySeq class: // 1. The number of elements in the sequences is in the instance variable // manyItems.
  • 13. // 2. For an empty sequence (with no elements), we do not care what is // stored in any of data; for a non-empty sequence, the elements of the // sequence are stored in data[0] through data[manyItems-1], and we // don care what in the rest of data. // 3. If there is a current element, then it lies in data[currentIndex]; // if there is no current element, then currentIndex equals manyItems. private double[ ] data; private int manyItems; private int currentIndex; /** * Initialize an empty sequence with an initial capacity of 10. Note that * the addAfter and addBefore methods work * efficiently (without needing more memory) until this capacity is reached. * @param - none * @postcondition * This sequence is empty and has an initial capacity of 10. * @exception OutOfMemoryError * Indicates insufficient memory for: * new double[10]. **/ public DoubleArraySeq( ) { //Set manyItems to 0. manyItems=0; //Initialize data data=new double[10]; } /** * Initialize an empty sequence with a specified initial capacity. Note that * the addAfter and addBefore methods work * efficiently (without needing more memory) until this capacity is reached. * @param initialCapacity * the initial capacity of this sequence * @precondition
  • 14. * initialCapacity is non-negative. * @postcondition * This sequence is empty and has the given initial capacity. * @exception IllegalArgumentException * Indicates that initialCapacity is negative. * @exception OutOfMemoryError * Indicates insufficient memory for: * new double[initialCapacity]. **/ public DoubleArraySeq(int initialCapacity) { //Check initialCapacity. If it is <0, throw EXCEPTION if(initialCapacity < 0) //Throw EXCEPTION throw new IllegalArgumentException ("initialCapacity IS NEGATIVE:"); //Set manyItems to 0. manyItems = 0; try { data = new double[initialCapacity]; } catch(OutOfMemoryError ea) { throw new RuntimeException ("NOT ENOUGH MEMORY"); } } /** * Add a new element to this sequence, after the current element. * If the new element would take this sequence beyond its current capacity, * then the capacity is increased before adding the new element. * @param element * the new element that is being added * @postcondition * A new copy of the element has been added to this sequence. If there was
  • 15. * a current element, then the new element is placed after the current * element. If there was no current element, then the new element is placed * at the end of the sequence. In all cases, the new element becomes the * new current element of this sequence. * @exception OutOfMemoryError * Indicates insufficient memory for increasing the sequence's capacity. * @note * An attempt to increase the capacity beyond * Integer.MAX_VALUE will cause the sequence to fail with an * arithmetic overflow. **/ public void addAfter(double element) { //Check the capacity. If array is full, increase its capacity if(manyItems == data.length) { //Increase capacity ensureCapacity(2*manyItems+1); } //If enough space is available for new element else { //If current element exists if(isCurrent()) { //Loop to make space for(int kk = manyItems ;kk > currentIndex+1 ; kk--) { data[kk] = data[kk-1]; } //Insert the new element data[currentIndex+1] = element; //Increment the current index currentIndex +=1; //Increment the element count
  • 16. manyItems++; } //If current element not present else{ //Add element at the last data[manyItems] = element; //Increment the element count manyItems++; } } } /** * Add a new element to this sequence, before the current element. * If the new element would take this sequence beyond its current capacity, * then the capacity is increased before adding the new element. * @param element * the new element that is being added * @postcondition * A new copy of the element has been added to this sequence. If there was * a current element, then the new element is placed before the current * element. If there was no current element, then the new element is placed * at the start of the sequence. In all cases, the new element becomes the * new current element of this sequence. * @exception OutOfMemoryError * Indicates insufficient memory for increasing the sequence's capacity. * @note * An attempt to increase the capacity beyond * Integer.MAX_VALUE will cause the sequence to fail with an * arithmetic overflow. **/ public void addBefore(double element) { //Check the capacity. If array is full, increase its capacity if(manyItems == data.length) { ensureCapacity(2*manyItems+1);
  • 17. } else { //If current element exists if(isCurrent()) { //Loop to make space for new element for(int kk = manyItems ;kk > currentIndex ; kk--) { data[kk] = data[kk-1]; } //Place the new element at the current index data[currentIndex] = element; //Increment element counts manyItems++; } //If current element doesn't exist then else { //Loop to move elements for(int kk = manyItems; kk>0;kk--) { data[kk] = data[kk-1]; } //Place new element at the sequence begining data[0] = element; //Increment element counts manyItems++; } } } /** * Place the contents of another sequence at the end of this sequence.
  • 18. * @param addend * a sequence whose contents will be placed at the end of this sequence * @precondition * The parameter, addend, is not null. * @postcondition * The elements from addend have been placed at the end of * this sequence. The current element of this sequence remains where it * was, and the addend is also unchanged. * @exception NullPointerException * Indicates that addend is null. * @exception OutOfMemoryError * Indicates insufficient memory to increase the size of this sequence. * @note * An attempt to increase the capacity beyond * Integer.MAX_VALUE will cause an arithmetic overflow * that will cause the sequence to fail. **/ public void addAll(DoubleArraySeq addend) { //Ensure the capacity ensureCapacity(addend.manyItems +manyItems); //Copy the addend elements System.arraycopy(addend.data, 0, data, manyItems, addend.manyItems); //Set the manyItems manyItems = manyItems + addend.manyItems; } /** * Move forward, so that the current element is now the next element in * this sequence. * @param - none * @precondition * isCurrent() returns true. * @postcondition * If the current element was already the end element of this sequence
  • 19. * (with nothing after it), then there is no longer any current element. * Otherwise, the new element is the element immediately after the * original current element. * @exception IllegalStateException * Indicates that there is no current element, so * advance may not be called. **/ public void advance( ) { // If current element exists. currentIndex +=1; } /** * Generate a copy of this sequence. * @param - none * @return * The return value is a copy of this sequence. Subsequent changes to the * copy will not affect the original, nor vice versa. * @exception OutOfMemoryError * Indicates insufficient memory for creating the clone. **/ public DoubleArraySeq clone( ) { // Clone a DoubleArraySeq object. DoubleArraySeq answer; try { answer = (DoubleArraySeq) super.clone( ); } catch (CloneNotSupportedException e) { // This exception should not occur. But if it does, it would probably // indicate a programming error that made super.clone unavailable.
  • 20. // The most common error would be forgetting the "Implements Cloneable" // clause at the start of this class. throw new RuntimeException ("This class does not implement Cloneable"); } answer.data = data.clone( ); return answer; } /** * Create a new sequence that contains all the elements from one sequence * followed by another. * @param s1 * the first of two sequences * @param s2 * the second of two sequences * @precondition * Neither s1 nor s2 is null. * @return * a new sequence that has the elements of s1 followed by the * elements of s2 (with no current element) * @exception NullPointerException. * Indicates that one of the arguments is null. * @exception OutOfMemoryError * Indicates insufficient memory for the new sequence. * @note * An attempt to create a sequence with a capacity beyond * Integer.MAX_VALUE will cause an arithmetic overflow * that will cause the sequence to fail. **/ public static DoubleArraySeq concatenation(DoubleArraySeq s1, DoubleArraySeq s2) { //Create new DoubleArraySeq with initial capacity to hold s1 and s2 elements DoubleArraySeq newAry = new DoubleArraySeq(s1.getCapacity()+s2.getCapacity()); //Copy s1 elements
  • 21. System.arraycopy(s1.data, 0, newAry.data, 0, s1.manyItems); //Copy s2 elements System.arraycopy(s2.data, 0, newAry.data, s1.manyItems, s2.manyItems); //Set manyItems of newAry newAry.manyItems = s1.manyItems+s2.manyItems; //Set current element of newAry newAry.currentIndex = newAry.manyItems; //return newAry return newAry; } /** * Change the current capacity of this sequence. * @param minimumCapacity * the new capacity for this sequence * @postcondition * This sequence's capacity has been changed to at least minimumCapacity. * If the capacity was already at or greater than minimumCapacity, * then the capacity is left unchanged. * @exception OutOfMemoryError * Indicates insufficient memory for: new int[minimumCapacity]. **/ public void ensureCapacity(int minimumCapacity) { //Create a new array double[] newBigAry; //Check array's capacity is less than minimumCapacity. //If so, set array's capacity to minimumCapacity if(data.length < minimumCapacity) { //Initialize new array newBigAry = new double[minimumCapacity]; //Copy elements into new array System.arraycopy(data, 0, newBigAry, 0, manyItems); //Set data to new array data = newBigAry; }
  • 22. } /** * Accessor method to get the current capacity of this sequence. * The add method works efficiently (without needing * more memory) until this capacity is reached. * @param - none * @return * the current capacity of this sequence **/ public int getCapacity( ) { // return the capacity of array return data.length; } /** * Accessor method to get the current element of this sequence. * @param - none * @precondition * isCurrent() returns true. * @return * the current element of this sequence * @exception IllegalStateException * Indicates that there is no current element, so * getCurrent may not be called. **/ public double getCurrent( ) { //If current element exists if(isCurrent()) //Return the current element return data[currentIndex]; //If current element doesn't exist else //throw EXCEPTION throw new IllegalArgumentException
  • 23. ("no CURRENT ELEMENT"); } /** * Accessor method to determine whether this sequence has a specified * current element that can be retrieved with the * getCurrent method. * @param - none * @return * true (there is a current element) or false (there is no current element at the moment) **/ public boolean isCurrent( ) { //If current element exist if(currentIndex != manyItems) //Return true return true; //if current element doesnt exist else{ //Return false. return false; } } /** * Remove the current element from this sequence. * @param - none * @precondition * isCurrent() returns true. * @postcondition * The current element has been removed from this sequence, and the * following element (if there is one) is now the new current element. * If there was no following element, then there is now no current * element. * @exception IllegalStateException * Indicates that there is no current element, so * removeCurrent may not be called.
  • 24. **/ public void removeCurrent( ) { //If current element exists if(isCurrent()) { //If current element is the last-element if(currentIndex == manyItems-1) { //Decrease the element count manyItems -=1; } //If current-element is in middle of the sequence else { //Loop to delete the current element by next element for(int kk= currentIndex;kk