a.Write a small Java program that contains a method with the signature

public static ArrayList intersection(ArrayList a, ArrayList b)

and that returns an ArrayList of objects that are in both of the two provided ArrayList arguments. Your program should be documented using Javadocs and follow good Java programming style. Provide your intersection method (including Javadoc comments).

b.After initially writing your intersection method according to the provided requirements, you may discover possible defects and/or ambiguities in the requirements. Describe at least 3 possible faults.

c.Create a set of test cases that you think would have a reasonable chance of revealing each of the 4 faults you identified in (b). Describe your rationale for each test in your test set. Finally, instrument your code (in the main method) to execute your test set and describe the results for each.

d.Rewrite your intersection method to fix the defects/ambiguities you identified in (b). Provide your updated intersection method here and rerun the code with the instrumented test set from (c) and describe the new results for each.

e.Complete Section 1.2 #3 for the findLast method. To do this, rewrite the method in an executable Java program. (below is 1.2#3 and I think the issue is that it should be i>=0 instead of >0 but not sure)


public int Ô¨ĀndLast (int[] x, int y) {
//Effects: If x==null throw NullPointerException
// else return the index of the last element
// in x that equals y.
// If no such element exists, return -1
for (int i=x.length-1; i > 0; i--)
{ if (x[i] == y)
{ return i; return i; }
} return -1; }
// test: x=[2, 3, 5]; y = 2
// Expected = 0


Identify the fault. (b) If possible, identify a test case that does not execute the fault. (c) If possible, identify a test case that executes the fault, but does not result in an error state. (d) If possible identify a test case that results in an error, but not a failure. Hint: Dont forget about the program counter. (e) For the given test case, identify the rst error state. Be sure to describe the complete state. (f) Fix the fault and verify that the given test now produces the expected output.

Academic Honesty!
It is not our intention to break the school's academic policy. Projects posted are only used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly fill out the form. Please provide a valid email address and we'll get back to you in less than 24 hours. We will be sending an invoice through PayPal upon confirmation. We are a non profit organization however we need an amount to keep this organization running, and to be able to complete our research and development.