This is a java program and you must therefore define a main() method

computer science

Description

This is a java program and you must therefore define a main() method. You are to create a test program to utilize your IntArray11 class. The program itself is “freeform” and will be graded by inspection by the readers. Your IntArray11Test program is intended to help you write your IntArray11 class. The only hard requirement of your IntArray11Test program is that it must perform at least one meaningful test (invocation) of each public IntArray11 method. See the sample IntArray11Test program provided. It tests several methods: 1. Constructors 2. getArray() method 3. getNArrays() method You should add to this program, using the comments as a guide. Notice how a logical test has been coded into a method. the supplied program as a guide. .


 Feel free to simply add new tests to main() using Good practice would be construct a logical test inside a method and then invoke the method from within main() Don’t forget to put your name in the file after the existing Javadoc @author tag (replace YOUR NAME HERE) The goal of this part of the assignment is for you to practice writing code that helps you in debugging. A good test should have a known outcome that you can verify. For example in the test program supplied, the testGetArray() method uses the constructor to create an array with elements [1..100], it then gets a copy of the array and validates that each element was set as expected. 


You could use almost the identical code to write a test for getElement(). Some hints for solving Task 2: 1. Build your IntArray11 class in stages. Define a method, then define a test for the method in IntArray11Test.java. Once you are satisfied that the method you have just coded is correct, move onto the next one. 2. Utilize private methods as you need them. An internal (helper) method to copy the contents of one array to another might be useful 3. Do NOT assume that arrays of only a certain size will be constructed. 4. Properly indent your test code, but do not be overly concerned with comments. A line or two commenting what a test is trying to do is helpful. 5. If you write a test and it works the first time, change your IntArray11 code in some small way to so that it should NOT pass the test. The idea is to validate that your test is doing what you think it does. Don’t forget to return your IntArray11 code to the proper state! For example, in the test, you could have the constructor generate [0 .. 99] (which is incorrect) and verify that the test fails.


Related Questions in computer science category


Disclaimer
The ready solutions purchased from Library are already used solutions. Please do not submit them directly as it may lead to plagiarism. Once paid, the solution file download link will be sent to your provided email. Please either use them for learning purpose or re-write them in your own language. In case if you haven't get the email, do let us know via chat support.