Question: In a program, write a method that accepts two arguments: an array of integers and a number n. The method should print all of the
In a program, write a method that accepts two arguments: an array of integers and a number n. The method should print all of the numbers in the array that are greater than the number n (in the order that they appear in the array, each on their own line). In the same file, create a main method and call your function using the following data sets: The array {1, 5, 10, 2, 4, -3, 6} and the number 3. The array {10, 12, 15, 24} and the number 12.
My code:
public class LargerThanN { public static void print(int[] array,int n) { for(int i=0; i
public static void main(String[] args) { int[] array1 = {1,5,10,2,4,-3,6}; int num1=3; print(array1,num1); int[] array2 = {10, 12, 15, 24}; int num2 = 12; print(array2, num2); } }
My programming lab does not want extra lines between the output. What am I doing wrong? How do I fix it?

Failed Test Run The contents of your standard output is incorrect. Attention: the difference between your stdout and the expected stdout is just a question of spacing. Standard Output Hide Invisibles Your Code's Actual Result: Expected Result: 54 104 10 6.4 15 24.4 15. 24
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
