Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

//Inputs.java code package code; import java.util.ArrayList; public class Inputs

ID: 3686811 • Letter: #

Question

//Inputs.java code

package code;

import java.util.ArrayList;

public class Inputs {

// Study the definition of the method
   // method_2
   // defined in the class Methods.
   // Define the following method so it returns a value which,
   // if passed as an argument to method_2,
   // causes method_2 to return the value 20.
   public ArrayList<Integer> inputForMethod_2() {
       return null;
   }
  
   // Study the definition of the method
   // method_3
   // defined in the class Methods.
   // Define the following method so it returns a value which,
   // if passed as an argument to method_3,
   // causes method_3 to return the value 20.
   public ArrayList<String> inputForMethod_3() {
       return null;
   }
  
   // Study the definition of the method
   // method_4
   // defined in the class Methods.
   // Define the following method so it returns a value which,
   // if passed as an argument to method_4,
   // causes method_4 to return the value 20.
   public ArrayList<String> inputForMethod_4() {
       return null;
   }

Inputs.java Methodsjava 3 1 package code,; 2 3 import java.util.ArrayList; 4 5 public class Methods 6 public int method-2(ArrayList

Explanation / Answer

class Inputs {

// Study the definition of the method
   // method_2
   // defined in the class Methods.
   // Define the following method so it returns a value which,
   // if passed as an argument to method_2,
   // causes method_2 to return the value 20.
   public ArrayList<Integer> inputForMethod_2() {
       ArrayList<Integer> input=new ArrayList<Integer>();
       for(int i=0;i<10;i++)
       input.add(1);
       return input;
    }
    // Study the definition of the method
   // method_3
   // defined in the class Methods.
   // Define the following method so it returns a value which,
   // if passed as an argument to method_3,
   // causes method_3 to return the value 20.
   public ArrayList<String> inputForMethod_3() {
      ArrayList<String> input=new ArrayList<String>();
       for(int i=0;i<10;i++)
       input.add("a");
       return input;
   }
   // Study the definition of the method
   // method_4
   // defined in the class Methods.
   // Define the following method so it returns a value which,
   // if passed as an argument to method_4,
   // causes method_4 to return the value 20.
   public ArrayList<String> inputForMethod_4() {
        ArrayList<String> input=new ArrayList<String>();
       for(int i=0;i<10;i++)
       input.add("a");
       return input;
   }
}