Question
I need to create that sample output using the sample data that has been provided. Please use the code that I have provided to complete
I need to create that sample output using the sample data that has been provided. Please use the code that I have provided to complete this. I have given the runner and the other code.
Runner:
// A+ Computer Science - www.apluscompsci.com //Name - //Date - //Class - //Lab -
import java.util.Arrays;
public class ArrayFunHouseRunner extends ArrayFunHouse { public static void main( String args[] ) { int[] one = {4,10,0,1,7,6,5,3,2,9};
System.out.println(Arrays.toString(one)); System.out.println("sum of spots 3-6 = " + ArrayFunHouse.getSum(one,3,6)); System.out.println("sum of spots 2-9 = " + ArrayFunHouse.getSum(one,2,9)); System.out.println("# of 4s = " + ArrayFunHouse.getCount(one,4)); System.out.println("# of 9s = " + ArrayFunHouse.getCount(one,9));
int[] two = {4,2,3,4,6,7,8,9,0,10,0,1,7,6,5,3,2,9,9,8,7};
//add test cases
} }
Other Code:
// A+ Computer Science - www.apluscompsci.com //Name - //Date - //Class - //Lab -
import java.lang.System; import java.lang.Math;
public class ArrayFunHouse { //instance variables and constructors could be used, but are not really needed
//getSum() will return the sum of the numbers from start to stop, not including stop public static int getSum(int[] numArray, int start, int stop) { return 0; }
//getCount() will return number of times val is present public static int getCount(int[] numArray, int val) { return 0; }
public static int[] removeVal(int[] numArray, int val) { return null; } }
Sample Data : [7, 4, 10, 0, 1, 7, 6, 5, 3, 2, 9, 7] [7, 4, 2, 7, 3, 4, 6, 7, 8, 9, 7, 0, 10, 7, 0, 1, 7, 6, 5, 7, 3, 2, 7, 9, 9, 8,7] = = Sample Output : Files Needed :: [7, 4, 10, 0, 1, 7, 6, 5, 3, 2, 9, 7] ArrayFunHouse.java sum of spots 3-6 14 ArrayFunHouseRunner.java sum of spots 2-9 34 # of 4s 1 # of 9s 1 # of 75 3 new array with all 7s removed [4, 10, 0, 1, 6, 5, 3, 2, 9] # of 75 0 = = = = = [7, 4, 2, 7, 3, 4, 6, 7, 8, 9, 7, 0, 10, 7, 0, 1, 7, 6, 5, 7, 3, 2, 7, 9, 9, 8,7] sum of spots 3-16 76 sum of spots 2-9 46 # of Os 2 # of 3s 2 # of 75 9 new array with all 7s removed [4, 2, 3, 4, 6, 8, 9, 0, 10, 0, 1, 6, 5, 3, 2, 9, 9, 8] # of 7 s 0 = = =Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started