Add a new method to ArrayTools called filter. Make this method accept a String array. Change all the Strings that are longer than 5 characters to uppercase.
ArrayTools:
public class ArrayTools{public static int printAll(String[] array){int size= array.length;for(int i=0;i<>{System.out.println("["+i+"]: "+array[i]);}return size;}
Demo3 code:
import java.util.Scanner;
public class Demo3{ public static void main(String[] args) { Scanner keyboard = new Scanner(System.in);
System.out.println("How many strings?"); int size = keyboard.nextInt(); keyboard.nextLine();
String[] arr = new String[size];
for (int subscript = 0; subscript < size;=""> { System.out.println("Enter a value:"); arr[subscript] = keyboard.nextLine(); }
ArrayTools.filter(arr); ArrayTools.printAll(arr);
}}
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here