SlideShare a Scribd company logo
Given the following class in Java :
public class ThreeTenDynArray<T> {
//default initial capacity / minimum capacity
private static final int MIN_CAPACITY = 2;
//underlying array for storage -- you MUST use this for credit!
//Do NOT change the name or type
private T[] data;
private int size = 0;
private int capacity = 0;
// ADD MORE PRIVATE MEMBERS HERE IF NEEDED!
/**
*
*/
@SuppressWarnings("unchecked")
public ThreeTenDynArray() {
// Constructor
// Initial capacity of the storage should be MIN_CAPACITY
// Hint: Can't remember how to make an array of generic Ts? It's in the textbook...
data = (T[])(new Object[MIN_CAPACITY]);
size = 0;
capacity = MIN_CAPACITY;
}
/**
* @param initCapacity
*/
@SuppressWarnings("unchecked")
public ThreeTenDynArray(int initCapacity) {
// Constructor
// Initial capacity of the storage should be initCapacity.
// - Throw IllegalArgumentException if initCapacity is smaller than
// MIN_CAPACITY 2
// - Use this _exact_ error message for the exception
// (quotes are not part of the message):
// "Capacity must be at least 2!"
if (initCapacity < MIN_CAPACITY) {
throw new IllegalArgumentException("Capacity must be at least 2!");
}
}
/**
* @return
*/
public int size() {
// Report the current number of elements
// O(1)
return size; //default return, remove/change as needed
}
/**
* @return
*/
public int capacity() {
// Report max number of elements of the current storage
// (subject to change since this is a _dynamic_ )
// O(1)
return capacity; //default return, remove/change as needed
}
/**
* @param index index you're changing
* @param value what you're adding
* @return the old item at the index
*/
public T set(int index, T value) {
// Replace the item at the given index to be the given value.
// Return the old item at that index.
// Note: You cannot add new items (i.e. cannot increase size) with this method.
// O(1)
//return firstIndexOf(value);
// - Throw IndexOutOfBoundsException if index is not valid
// - Use this code to produce the correct error message for
// the exception (do not use a different message):
// "Index: " + index + " out of bounds!"
if (index < 0 && index >= size) {
throw new IndexOutOfBoundsException("Index: " + index + " out of bounds!");
}
// - Throw IllegalArgumentException if value is null.
// - Use this _exact_ error message for the exception
// (quotes are not part of the message):
// "Cannot include null values!"
if (value==null) {
throw new IllegalArgumentException("Cannot include null values!");
}
T oldValue = data[index];
data[index] = value;
return oldValue; //default return, remove/change as needed
}
/**
* @param index
* @return
*/
public T get(int index) {
// Return the item at the given index
if (index < 0 && index >= size) {
throw new IndexOutOfBoundsException("Index: " + index + " out of bounds!");
}
// O(1)
// Use the exception (and error message) described in set()
// for invalid indicies.
return data[index]; //default return, remove/change as needed
}
/**
* @param value
*/
@SuppressWarnings("unchecked")
public void append(T value) {
// Append an element to the end of the storage.
// Double the capacity if no space available.
// Code reuse! Consider using setCapacity (see below).
// For a null value, use the same exception and message
// as set().
// You can assume we will never need to grow the capacity to a value
// beyond Integer.MAX_VALUE/4. No need to check or test that boundary
// value when you grow the capacity.
// Amortized O(1)
// - Throw IllegalArgumentException if value is null.
// - Use the same error message as set().
if (value==null) {
throw new IllegalArgumentException("Cannot include null values!");
}
if (size < capacity) {
data[size] = value;
size++;
}
else{
capacity *= 2;
T[] data2 = (T[])(new Object[capacity]);
for (int i =0; i < data.length; i++) {
data2[i] = data[i];
}
data = data2;
data[size] = value;
size++;
}
}
/**
* @param index
* @param value
*/
@SuppressWarnings("unchecked")
public void insert(int index, T value) {
// Insert the given value at the given index and shift elements if needed.
// You _can_ append items with this method.
// Double capacity if no space available.
// Assume the same as append() for the upper bound of capacity.
// Code reuse! Consider using setCapacity (see below).
// For an invalid index or a null value, use the same exception and message
// as set(). However, remember that the condition of the exception is
// different (a different invalid range for indexes).
if (index >= capacity || index < 0 ) {
throw new IndexOutOfBoundsException("Index: " + index + " out of bounds!");
}
for (int i = size-1; i >= index; i--) {
data[i+1] = data[i];
}
data[index] = value;
size++;
// O(N) where N is the number of elements in the storage
}
/**
* @param index
* @return
*/
@SuppressWarnings("unchecked")
public T remove(int index) {
// Remove and return the element at the given index. Shift elements
// to ensure no gap. Throw an exception when there is an invalid
// index (see set(), get(), etc. above).
// Halve capacity (rounding down) of the storage if the number of elements falls
// below or at 1/4 of the capacity.
// However, capacity should NOT go below MIN_CAPACITY.
// Code reuse! Consider using setCapacity (see below).
// O(N) where N is the number of elements currently in the storage
if (index >= capacity || index < 0 ) {
throw new IndexOutOfBoundsException("Index: " + index + " out of bounds!");
}
T oldValue = data[index];
for (int i = index; i < data.length-1; i++) {
data[i] = data[i + 1];
}
size--;
if(size<=capacity/4)
{
capacity/=2;
if(capacity<MIN_CAPACITY)
capacity = MIN_CAPACITY;
}
return oldValue ; //default return, remove/change as needed
}
/**
* @param newCapacity
* @return
*/
@SuppressWarnings("unchecked")
public boolean setCapacity(int newCapacity) {
// Change the max number of items allowed before next expansion to newCapacity.
// No other changes to the current values in storage
// (i.e. they should all keep the same index).
// Capacity should not be changed if:
// - newCapacity is below MIN_CAPACITY; or
// - newCapacity is not large enough to accommodate current number of items
// Return false if newCapacity cannot be applied; return true otherwise.
// Special case: if newCapacity is identical to the current max number of items,
// no need to change anything but still return true.
// O(N) where N is the number of elements in the array
if (newCapacity < MIN_CAPACITY || newCapacity < size) {
return false; //default return, remove/change as needed
}
else if (newCapacity == size) {
return true;
}
return false;
}
/**
* @param value
* @return
*/
public int firstIndexOf(T value) {
// Return the index of the first occurrence of value or -1 if not found.
// NOTES: - Remember null is not a valid item in list.
// - Remember to use .equals for comparison of non-null values.
// O(N) where N is the number of elements in the list
if (value==null) {
return -1;
}
return -1; //default return, remove/change as needed
}
Please explain these errors and how to fix them.
Errors when testing:
1) test_append3(ThreeTenDynArrayTester)
java.lang.NullPointerException: Cannot read the array length because "this.data" is null
at ThreeTenDynArray.append(ThreeTenDynArray.java:161)
at ThreeTenDynArrayTester.test_append3(ThreeTenDynArrayTester.java:146)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.ja
va:77)
at
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccesso
rImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at
org.junit.internal.runners.statements.FailOnTimeout$StatementThread.run(FailOnTimeout.java:7
4)
2) test_setCapacity1(ThreeTenDynArrayTester)
java.lang.AssertionError: Capacity failed to grow, expected capacity 8
at org.junit.Assert.fail(Assert.java:88)
at org.junit.Assert.assertTrue(Assert.java:41)
at ThreeTenDynArrayTester.test_setCapacity1(ThreeTenDynArrayTester.java:694)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.ja
va:77)
at
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccesso
rImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at
org.junit.internal.runners.statements.FailOnTimeout$StatementThread.run(FailOnTimeout.java:7
4)
3) test_constructor2(ThreeTenDynArrayTester)
java.lang.AssertionError: Initial capacity of the storage has incorrect initCapacity
at org.junit.Assert.fail(Assert.java:88)
at org.junit.Assert.assertTrue(Assert.java:41)
at ThreeTenDynArrayTester.test_constructor2(ThreeTenDynArrayTester.java:90)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.ja
va:77)
at
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccesso
rImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at
org.junit.internal.runners.statements.FailOnTimeout$StatementThread.run(FailOnTimeout.java:7
4)
Given the following class in Java-  public class ThreeTenDynArray-T- {.pdf

More Related Content

Similar to Given the following class in Java- public class ThreeTenDynArray-T- {.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
mumnesh
 
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
firstchoiceajmer
 
AnswerNote Driver class is not given to test the DoubleArraySeq..pdf
AnswerNote Driver class is not given to test the DoubleArraySeq..pdfAnswerNote Driver class is not given to test the DoubleArraySeq..pdf
AnswerNote Driver class is not given to test the DoubleArraySeq..pdf
nipuns1983
 
Link list
Link listLink list
Link list
Malainine Zaid
 
@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
 
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
 
ReversePoem.java ---------------------------------- public cl.pdf
ReversePoem.java ---------------------------------- public cl.pdfReversePoem.java ---------------------------------- public cl.pdf
ReversePoem.java ---------------------------------- public cl.pdf
ravikapoorindia
 
I really need help with my C++ assignment. The following is the info.pdf
I really need help with my C++ assignment. The following is the info.pdfI really need help with my C++ assignment. The following is the info.pdf
I really need help with my C++ assignment. The following is the info.pdf
wasemanivytreenrco51
 
all i need is these two filesCreate VectorContainer.hppCreat.docx
all i need is these two filesCreate VectorContainer.hppCreat.docxall i need is these two filesCreate VectorContainer.hppCreat.docx
all i need is these two filesCreate VectorContainer.hppCreat.docx
jack60216
 
PriorityQueue.cs Jim Mischel using System; using Sy.pdf
 PriorityQueue.cs   Jim Mischel using System; using Sy.pdf PriorityQueue.cs   Jim Mischel using System; using Sy.pdf
PriorityQueue.cs Jim Mischel using System; using Sy.pdf
rajat630669
 
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
shericehewat
 
On the code which has a class in which I implementing a binary tree .pdf
On the code which has a class in which I implementing a binary tree .pdfOn the code which has a class in which I implementing a binary tree .pdf
On the code which has a class in which I implementing a binary tree .pdf
wasemanivytreenrco51
 
Were writing code for a project that dynamically allocates an arra.pdf
Were writing code for a project that dynamically allocates an arra.pdfWere writing code for a project that dynamically allocates an arra.pdf
Were writing code for a project that dynamically allocates an arra.pdf
fsenterprises
 
Use a simple vector you created before to create two other more
Use a simple vector you created before to create two other more Use a simple vector you created before to create two other more
Use a simple vector you created before to create two other more
steviesellars
 
in c languageTo determine the maximum string length, we need to .pdf
in c languageTo determine the maximum string length, we need to .pdfin c languageTo determine the maximum string length, we need to .pdf
in c languageTo determine the maximum string length, we need to .pdf
stopgolook
 
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
Lalkamal2
 
Stack Implementation
Stack ImplementationStack Implementation
Stack Implementation
Zidny Nafan
 
Given the code below create a method called, getCollisionCount that .pdf
Given the code below create a method called, getCollisionCount that .pdfGiven the code below create a method called, getCollisionCount that .pdf
Given the code below create a method called, getCollisionCount that .pdf
aucmistry
 
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
alanfhall8953
 
using the code below write the public V add(K key, V value); that ad.pdf
using the code below write the public V add(K key, V value); that ad.pdfusing the code below write the public V add(K key, V value); that ad.pdf
using the code below write the public V add(K key, V value); that ad.pdf
amirthagiftsmadurai
 

Similar to Given the following class in Java- public class ThreeTenDynArray-T- {.pdf (20)

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
 
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
 
AnswerNote Driver class is not given to test the DoubleArraySeq..pdf
AnswerNote Driver class is not given to test the DoubleArraySeq..pdfAnswerNote Driver class is not given to test the DoubleArraySeq..pdf
AnswerNote Driver class is not given to test the DoubleArraySeq..pdf
 
Link list
Link listLink list
Link list
 
@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
 
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
 
ReversePoem.java ---------------------------------- public cl.pdf
ReversePoem.java ---------------------------------- public cl.pdfReversePoem.java ---------------------------------- public cl.pdf
ReversePoem.java ---------------------------------- public cl.pdf
 
I really need help with my C++ assignment. The following is the info.pdf
I really need help with my C++ assignment. The following is the info.pdfI really need help with my C++ assignment. The following is the info.pdf
I really need help with my C++ assignment. The following is the info.pdf
 
all i need is these two filesCreate VectorContainer.hppCreat.docx
all i need is these two filesCreate VectorContainer.hppCreat.docxall i need is these two filesCreate VectorContainer.hppCreat.docx
all i need is these two filesCreate VectorContainer.hppCreat.docx
 
PriorityQueue.cs Jim Mischel using System; using Sy.pdf
 PriorityQueue.cs   Jim Mischel using System; using Sy.pdf PriorityQueue.cs   Jim Mischel using System; using Sy.pdf
PriorityQueue.cs Jim Mischel using System; using Sy.pdf
 
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
 
On the code which has a class in which I implementing a binary tree .pdf
On the code which has a class in which I implementing a binary tree .pdfOn the code which has a class in which I implementing a binary tree .pdf
On the code which has a class in which I implementing a binary tree .pdf
 
Were writing code for a project that dynamically allocates an arra.pdf
Were writing code for a project that dynamically allocates an arra.pdfWere writing code for a project that dynamically allocates an arra.pdf
Were writing code for a project that dynamically allocates an arra.pdf
 
Use a simple vector you created before to create two other more
Use a simple vector you created before to create two other more Use a simple vector you created before to create two other more
Use a simple vector you created before to create two other more
 
in c languageTo determine the maximum string length, we need to .pdf
in c languageTo determine the maximum string length, we need to .pdfin c languageTo determine the maximum string length, we need to .pdf
in c languageTo determine the maximum string length, we need to .pdf
 
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
 
Stack Implementation
Stack ImplementationStack Implementation
Stack Implementation
 
Given the code below create a method called, getCollisionCount that .pdf
Given the code below create a method called, getCollisionCount that .pdfGiven the code below create a method called, getCollisionCount that .pdf
Given the code below create a method called, getCollisionCount that .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
 
using the code below write the public V add(K key, V value); that ad.pdf
using the code below write the public V add(K key, V value); that ad.pdfusing the code below write the public V add(K key, V value); that ad.pdf
using the code below write the public V add(K key, V value); that ad.pdf
 

More from NicholasflqStewartl

he amount of income taxesThe amount of income taxes A- the corporation.pdf
he amount of income taxesThe amount of income taxes A- the corporation.pdfhe amount of income taxesThe amount of income taxes A- the corporation.pdf
he amount of income taxesThe amount of income taxes A- the corporation.pdf
NicholasflqStewartl
 
Having a hard time with this one- Fill in the blanks with the follow.pdf
Having a hard time with this one-   Fill in the blanks with the follow.pdfHaving a hard time with this one-   Fill in the blanks with the follow.pdf
Having a hard time with this one- Fill in the blanks with the follow.pdf
NicholasflqStewartl
 
Having a problem figuring out where my errors are- The code is not run.pdf
Having a problem figuring out where my errors are- The code is not run.pdfHaving a problem figuring out where my errors are- The code is not run.pdf
Having a problem figuring out where my errors are- The code is not run.pdf
NicholasflqStewartl
 
Harriet- Herm- and Ronde formed an S corporation called Innovet- Harri.pdf
Harriet- Herm- and Ronde formed an S corporation called Innovet- Harri.pdfHarriet- Herm- and Ronde formed an S corporation called Innovet- Harri.pdf
Harriet- Herm- and Ronde formed an S corporation called Innovet- Harri.pdf
NicholasflqStewartl
 
Hardworking Americans Should Not Be Living in Poverty has fallen to $6.pdf
Hardworking Americans Should Not Be Living in Poverty has fallen to $6.pdfHardworking Americans Should Not Be Living in Poverty has fallen to $6.pdf
Hardworking Americans Should Not Be Living in Poverty has fallen to $6.pdf
NicholasflqStewartl
 
Government and Not for profit accounting 2022 CAFR (City of Anaheim) S.pdf
Government and Not for profit accounting 2022 CAFR (City of Anaheim) S.pdfGovernment and Not for profit accounting 2022 CAFR (City of Anaheim) S.pdf
Government and Not for profit accounting 2022 CAFR (City of Anaheim) S.pdf
NicholasflqStewartl
 
Hammond Manufacturing Inc- was legally incorporated on January 2- 2020.pdf
Hammond Manufacturing Inc- was legally incorporated on January 2- 2020.pdfHammond Manufacturing Inc- was legally incorporated on January 2- 2020.pdf
Hammond Manufacturing Inc- was legally incorporated on January 2- 2020.pdf
NicholasflqStewartl
 
Hacer un programa en c++ que lea la frase y determine que caracteres s.pdf
Hacer un programa en c++ que lea la frase y determine que caracteres s.pdfHacer un programa en c++ que lea la frase y determine que caracteres s.pdf
Hacer un programa en c++ que lea la frase y determine que caracteres s.pdf
NicholasflqStewartl
 
Given the regular expression- 0(01)0 (a) Construct and -NFA and draw i.pdf
Given the regular expression- 0(01)0 (a) Construct and -NFA and draw i.pdfGiven the regular expression- 0(01)0 (a) Construct and -NFA and draw i.pdf
Given the regular expression- 0(01)0 (a) Construct and -NFA and draw i.pdf
NicholasflqStewartl
 
Grouper Corporation is authorized to issue both preferred and commonst.pdf
Grouper Corporation is authorized to issue both preferred and commonst.pdfGrouper Corporation is authorized to issue both preferred and commonst.pdf
Grouper Corporation is authorized to issue both preferred and commonst.pdf
NicholasflqStewartl
 
Guessing or knowing the initial TCP sequence number (ISN) that a serve.pdf
Guessing or knowing the initial TCP sequence number (ISN) that a serve.pdfGuessing or knowing the initial TCP sequence number (ISN) that a serve.pdf
Guessing or knowing the initial TCP sequence number (ISN) that a serve.pdf
NicholasflqStewartl
 
Given the following XML fragment- what XPath expression would select a.pdf
Given the following XML fragment- what XPath expression would select a.pdfGiven the following XML fragment- what XPath expression would select a.pdf
Given the following XML fragment- what XPath expression would select a.pdf
NicholasflqStewartl
 
Greener Pastures Corporation borrowed $1-100-000 on November 1- 2021-.pdf
Greener Pastures Corporation borrowed $1-100-000 on November 1- 2021-.pdfGreener Pastures Corporation borrowed $1-100-000 on November 1- 2021-.pdf
Greener Pastures Corporation borrowed $1-100-000 on November 1- 2021-.pdf
NicholasflqStewartl
 
Given the following for the Titan Company- the company began operation.pdf
Given the following for the Titan Company- the company began operation.pdfGiven the following for the Titan Company- the company began operation.pdf
Given the following for the Titan Company- the company began operation.pdf
NicholasflqStewartl
 
Given Information #1- Period 1 is when Devah is working and earning mo.pdf
Given Information #1- Period 1 is when Devah is working and earning mo.pdfGiven Information #1- Period 1 is when Devah is working and earning mo.pdf
Given Information #1- Period 1 is when Devah is working and earning mo.pdf
NicholasflqStewartl
 
Give concise and substantial answers by relating your answers to your.pdf
Give concise and substantial answers by relating your answers to your.pdfGive concise and substantial answers by relating your answers to your.pdf
Give concise and substantial answers by relating your answers to your.pdf
NicholasflqStewartl
 
Given a stream of strings- remove all empty strings- import java-uti.pdf
Given a stream of strings- remove all empty strings-   import java-uti.pdfGiven a stream of strings- remove all empty strings-   import java-uti.pdf
Given a stream of strings- remove all empty strings- import java-uti.pdf
NicholasflqStewartl
 
Given an IntNode struct and the operating functions for a linked list-.pdf
Given an IntNode struct and the operating functions for a linked list-.pdfGiven an IntNode struct and the operating functions for a linked list-.pdf
Given an IntNode struct and the operating functions for a linked list-.pdf
NicholasflqStewartl
 
Given a string- does -oce- appear in the middle of the string- To defi.pdf
Given a string- does -oce- appear in the middle of the string- To defi.pdfGiven a string- does -oce- appear in the middle of the string- To defi.pdf
Given a string- does -oce- appear in the middle of the string- To defi.pdf
NicholasflqStewartl
 
Give examples of species interactions that might be recognizable in th.pdf
Give examples of species interactions that might be recognizable in th.pdfGive examples of species interactions that might be recognizable in th.pdf
Give examples of species interactions that might be recognizable in th.pdf
NicholasflqStewartl
 

More from NicholasflqStewartl (20)

he amount of income taxesThe amount of income taxes A- the corporation.pdf
he amount of income taxesThe amount of income taxes A- the corporation.pdfhe amount of income taxesThe amount of income taxes A- the corporation.pdf
he amount of income taxesThe amount of income taxes A- the corporation.pdf
 
Having a hard time with this one- Fill in the blanks with the follow.pdf
Having a hard time with this one-   Fill in the blanks with the follow.pdfHaving a hard time with this one-   Fill in the blanks with the follow.pdf
Having a hard time with this one- Fill in the blanks with the follow.pdf
 
Having a problem figuring out where my errors are- The code is not run.pdf
Having a problem figuring out where my errors are- The code is not run.pdfHaving a problem figuring out where my errors are- The code is not run.pdf
Having a problem figuring out where my errors are- The code is not run.pdf
 
Harriet- Herm- and Ronde formed an S corporation called Innovet- Harri.pdf
Harriet- Herm- and Ronde formed an S corporation called Innovet- Harri.pdfHarriet- Herm- and Ronde formed an S corporation called Innovet- Harri.pdf
Harriet- Herm- and Ronde formed an S corporation called Innovet- Harri.pdf
 
Hardworking Americans Should Not Be Living in Poverty has fallen to $6.pdf
Hardworking Americans Should Not Be Living in Poverty has fallen to $6.pdfHardworking Americans Should Not Be Living in Poverty has fallen to $6.pdf
Hardworking Americans Should Not Be Living in Poverty has fallen to $6.pdf
 
Government and Not for profit accounting 2022 CAFR (City of Anaheim) S.pdf
Government and Not for profit accounting 2022 CAFR (City of Anaheim) S.pdfGovernment and Not for profit accounting 2022 CAFR (City of Anaheim) S.pdf
Government and Not for profit accounting 2022 CAFR (City of Anaheim) S.pdf
 
Hammond Manufacturing Inc- was legally incorporated on January 2- 2020.pdf
Hammond Manufacturing Inc- was legally incorporated on January 2- 2020.pdfHammond Manufacturing Inc- was legally incorporated on January 2- 2020.pdf
Hammond Manufacturing Inc- was legally incorporated on January 2- 2020.pdf
 
Hacer un programa en c++ que lea la frase y determine que caracteres s.pdf
Hacer un programa en c++ que lea la frase y determine que caracteres s.pdfHacer un programa en c++ que lea la frase y determine que caracteres s.pdf
Hacer un programa en c++ que lea la frase y determine que caracteres s.pdf
 
Given the regular expression- 0(01)0 (a) Construct and -NFA and draw i.pdf
Given the regular expression- 0(01)0 (a) Construct and -NFA and draw i.pdfGiven the regular expression- 0(01)0 (a) Construct and -NFA and draw i.pdf
Given the regular expression- 0(01)0 (a) Construct and -NFA and draw i.pdf
 
Grouper Corporation is authorized to issue both preferred and commonst.pdf
Grouper Corporation is authorized to issue both preferred and commonst.pdfGrouper Corporation is authorized to issue both preferred and commonst.pdf
Grouper Corporation is authorized to issue both preferred and commonst.pdf
 
Guessing or knowing the initial TCP sequence number (ISN) that a serve.pdf
Guessing or knowing the initial TCP sequence number (ISN) that a serve.pdfGuessing or knowing the initial TCP sequence number (ISN) that a serve.pdf
Guessing or knowing the initial TCP sequence number (ISN) that a serve.pdf
 
Given the following XML fragment- what XPath expression would select a.pdf
Given the following XML fragment- what XPath expression would select a.pdfGiven the following XML fragment- what XPath expression would select a.pdf
Given the following XML fragment- what XPath expression would select a.pdf
 
Greener Pastures Corporation borrowed $1-100-000 on November 1- 2021-.pdf
Greener Pastures Corporation borrowed $1-100-000 on November 1- 2021-.pdfGreener Pastures Corporation borrowed $1-100-000 on November 1- 2021-.pdf
Greener Pastures Corporation borrowed $1-100-000 on November 1- 2021-.pdf
 
Given the following for the Titan Company- the company began operation.pdf
Given the following for the Titan Company- the company began operation.pdfGiven the following for the Titan Company- the company began operation.pdf
Given the following for the Titan Company- the company began operation.pdf
 
Given Information #1- Period 1 is when Devah is working and earning mo.pdf
Given Information #1- Period 1 is when Devah is working and earning mo.pdfGiven Information #1- Period 1 is when Devah is working and earning mo.pdf
Given Information #1- Period 1 is when Devah is working and earning mo.pdf
 
Give concise and substantial answers by relating your answers to your.pdf
Give concise and substantial answers by relating your answers to your.pdfGive concise and substantial answers by relating your answers to your.pdf
Give concise and substantial answers by relating your answers to your.pdf
 
Given a stream of strings- remove all empty strings- import java-uti.pdf
Given a stream of strings- remove all empty strings-   import java-uti.pdfGiven a stream of strings- remove all empty strings-   import java-uti.pdf
Given a stream of strings- remove all empty strings- import java-uti.pdf
 
Given an IntNode struct and the operating functions for a linked list-.pdf
Given an IntNode struct and the operating functions for a linked list-.pdfGiven an IntNode struct and the operating functions for a linked list-.pdf
Given an IntNode struct and the operating functions for a linked list-.pdf
 
Given a string- does -oce- appear in the middle of the string- To defi.pdf
Given a string- does -oce- appear in the middle of the string- To defi.pdfGiven a string- does -oce- appear in the middle of the string- To defi.pdf
Given a string- does -oce- appear in the middle of the string- To defi.pdf
 
Give examples of species interactions that might be recognizable in th.pdf
Give examples of species interactions that might be recognizable in th.pdfGive examples of species interactions that might be recognizable in th.pdf
Give examples of species interactions that might be recognizable in th.pdf
 

Recently uploaded

Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
BhavyaRajput3
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
timhan337
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Atul Kumar Singh
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
Levi Shapiro
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
RaedMohamed3
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
camakaiclarkmusic
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
SACHIN R KONDAGURI
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Po-Chuan Chen
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
Peter Windle
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
Jisc
 

Recently uploaded (20)

Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 

Given the following class in Java- public class ThreeTenDynArray-T- {.pdf

  • 1. Given the following class in Java : public class ThreeTenDynArray<T> { //default initial capacity / minimum capacity private static final int MIN_CAPACITY = 2; //underlying array for storage -- you MUST use this for credit! //Do NOT change the name or type private T[] data; private int size = 0; private int capacity = 0; // ADD MORE PRIVATE MEMBERS HERE IF NEEDED! /** * */ @SuppressWarnings("unchecked") public ThreeTenDynArray() { // Constructor // Initial capacity of the storage should be MIN_CAPACITY // Hint: Can't remember how to make an array of generic Ts? It's in the textbook... data = (T[])(new Object[MIN_CAPACITY]); size = 0; capacity = MIN_CAPACITY; } /**
  • 2. * @param initCapacity */ @SuppressWarnings("unchecked") public ThreeTenDynArray(int initCapacity) { // Constructor // Initial capacity of the storage should be initCapacity. // - Throw IllegalArgumentException if initCapacity is smaller than // MIN_CAPACITY 2 // - Use this _exact_ error message for the exception // (quotes are not part of the message): // "Capacity must be at least 2!" if (initCapacity < MIN_CAPACITY) { throw new IllegalArgumentException("Capacity must be at least 2!"); } } /** * @return */ public int size() { // Report the current number of elements // O(1) return size; //default return, remove/change as needed }
  • 3. /** * @return */ public int capacity() { // Report max number of elements of the current storage // (subject to change since this is a _dynamic_ ) // O(1) return capacity; //default return, remove/change as needed } /** * @param index index you're changing * @param value what you're adding * @return the old item at the index */ public T set(int index, T value) { // Replace the item at the given index to be the given value. // Return the old item at that index. // Note: You cannot add new items (i.e. cannot increase size) with this method. // O(1) //return firstIndexOf(value); // - Throw IndexOutOfBoundsException if index is not valid // - Use this code to produce the correct error message for // the exception (do not use a different message):
  • 4. // "Index: " + index + " out of bounds!" if (index < 0 && index >= size) { throw new IndexOutOfBoundsException("Index: " + index + " out of bounds!"); } // - Throw IllegalArgumentException if value is null. // - Use this _exact_ error message for the exception // (quotes are not part of the message): // "Cannot include null values!" if (value==null) { throw new IllegalArgumentException("Cannot include null values!"); } T oldValue = data[index]; data[index] = value; return oldValue; //default return, remove/change as needed } /** * @param index * @return */ public T get(int index) { // Return the item at the given index if (index < 0 && index >= size) { throw new IndexOutOfBoundsException("Index: " + index + " out of bounds!");
  • 5. } // O(1) // Use the exception (and error message) described in set() // for invalid indicies. return data[index]; //default return, remove/change as needed } /** * @param value */ @SuppressWarnings("unchecked") public void append(T value) { // Append an element to the end of the storage. // Double the capacity if no space available. // Code reuse! Consider using setCapacity (see below). // For a null value, use the same exception and message // as set(). // You can assume we will never need to grow the capacity to a value // beyond Integer.MAX_VALUE/4. No need to check or test that boundary // value when you grow the capacity. // Amortized O(1) // - Throw IllegalArgumentException if value is null. // - Use the same error message as set(). if (value==null) {
  • 6. throw new IllegalArgumentException("Cannot include null values!"); } if (size < capacity) { data[size] = value; size++; } else{ capacity *= 2; T[] data2 = (T[])(new Object[capacity]); for (int i =0; i < data.length; i++) { data2[i] = data[i]; } data = data2; data[size] = value; size++; } } /** * @param index * @param value */ @SuppressWarnings("unchecked") public void insert(int index, T value) {
  • 7. // Insert the given value at the given index and shift elements if needed. // You _can_ append items with this method. // Double capacity if no space available. // Assume the same as append() for the upper bound of capacity. // Code reuse! Consider using setCapacity (see below). // For an invalid index or a null value, use the same exception and message // as set(). However, remember that the condition of the exception is // different (a different invalid range for indexes). if (index >= capacity || index < 0 ) { throw new IndexOutOfBoundsException("Index: " + index + " out of bounds!"); } for (int i = size-1; i >= index; i--) { data[i+1] = data[i]; } data[index] = value; size++; // O(N) where N is the number of elements in the storage } /** * @param index * @return */ @SuppressWarnings("unchecked")
  • 8. public T remove(int index) { // Remove and return the element at the given index. Shift elements // to ensure no gap. Throw an exception when there is an invalid // index (see set(), get(), etc. above). // Halve capacity (rounding down) of the storage if the number of elements falls // below or at 1/4 of the capacity. // However, capacity should NOT go below MIN_CAPACITY. // Code reuse! Consider using setCapacity (see below). // O(N) where N is the number of elements currently in the storage if (index >= capacity || index < 0 ) { throw new IndexOutOfBoundsException("Index: " + index + " out of bounds!"); } T oldValue = data[index]; for (int i = index; i < data.length-1; i++) { data[i] = data[i + 1]; } size--; if(size<=capacity/4) { capacity/=2; if(capacity<MIN_CAPACITY) capacity = MIN_CAPACITY; }
  • 9. return oldValue ; //default return, remove/change as needed } /** * @param newCapacity * @return */ @SuppressWarnings("unchecked") public boolean setCapacity(int newCapacity) { // Change the max number of items allowed before next expansion to newCapacity. // No other changes to the current values in storage // (i.e. they should all keep the same index). // Capacity should not be changed if: // - newCapacity is below MIN_CAPACITY; or // - newCapacity is not large enough to accommodate current number of items // Return false if newCapacity cannot be applied; return true otherwise. // Special case: if newCapacity is identical to the current max number of items, // no need to change anything but still return true. // O(N) where N is the number of elements in the array if (newCapacity < MIN_CAPACITY || newCapacity < size) { return false; //default return, remove/change as needed } else if (newCapacity == size) { return true;
  • 10. } return false; } /** * @param value * @return */ public int firstIndexOf(T value) { // Return the index of the first occurrence of value or -1 if not found. // NOTES: - Remember null is not a valid item in list. // - Remember to use .equals for comparison of non-null values. // O(N) where N is the number of elements in the list if (value==null) { return -1; } return -1; //default return, remove/change as needed } Please explain these errors and how to fix them. Errors when testing: 1) test_append3(ThreeTenDynArrayTester) java.lang.NullPointerException: Cannot read the array length because "this.data" is null at ThreeTenDynArray.append(ThreeTenDynArray.java:161) at ThreeTenDynArrayTester.test_append3(ThreeTenDynArrayTester.java:146)
  • 11. at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.ja va:77) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccesso rImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:568) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.internal.runners.statements.FailOnTimeout$StatementThread.run(FailOnTimeout.java:7 4) 2) test_setCapacity1(ThreeTenDynArrayTester) java.lang.AssertionError: Capacity failed to grow, expected capacity 8 at org.junit.Assert.fail(Assert.java:88) at org.junit.Assert.assertTrue(Assert.java:41) at ThreeTenDynArrayTester.test_setCapacity1(ThreeTenDynArrayTester.java:694) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.ja va:77) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccesso rImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:568)
  • 12. at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.internal.runners.statements.FailOnTimeout$StatementThread.run(FailOnTimeout.java:7 4) 3) test_constructor2(ThreeTenDynArrayTester) java.lang.AssertionError: Initial capacity of the storage has incorrect initCapacity at org.junit.Assert.fail(Assert.java:88) at org.junit.Assert.assertTrue(Assert.java:41) at ThreeTenDynArrayTester.test_constructor2(ThreeTenDynArrayTester.java:90) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.ja va:77) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccesso rImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:568) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.internal.runners.statements.FailOnTimeout$StatementThread.run(FailOnTimeout.java:7 4)