Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Fill in the constructor that has no arguments. It must instantiate the array values as an array of size zero. (You must actually create the

image text in transcribed
Fill in the constructor that has no arguments. It must instantiate the array "values" as an array of size zero. (You must actually create the array, but specify 0 as the size.) Fill in the constructor that takes an int array as an argument. You sh a. 1. ould: 2. Assign to "values" a new array that is the same size as the parameter. b. Copy the elements from the parameter into this new array. Run the JUnit tests (PublicTests) to be sure your constructors are working (you should be passing the test called testConstructors)- if you aren't passing this test, then you won't be able to pass any of the subsequent tests. Fill in the "getSize" method. It simply returns the size of the list. Fill in the "getAt" method. It returns the element whose position in the list matches the parameter. (We are using 0-based indexing.) If the parameter is negative or exceeds the last index of the list then throw an IndexOutOfBoundsException. 3. 4. 5. 6. Fill in the "getTotal" method. It will return the sum of all entries in the list. 7. Fill in the "contains" method. It will return true if the parameter is in the list, false otherwise. 8. Fill in the "add" method. It should add the parameter to the end of the list. You will need to follow the steps below: a. Create another array that is one unit larger than the existing one. b. Copy all of the elements from the existing array over to the new one. c. Add the parameter to the end of the new array. d. Re-assign the instance variable "values" so that it refers to the new array

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Principles Programming And Performance

Authors: Patrick O'Neil, Elizabeth O'Neil

2nd Edition

1558605800, 978-1558605800

More Books

Students also viewed these Databases questions

Question

Provide examples of KPIs in Human Capital Management.

Answered: 1 week ago

Question

What are OLAP Cubes?

Answered: 1 week ago