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 {...


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);


  }
}





Test Case 1




How many strings?\n
8ENTER
Enter a value:\n
aaaaaaENTER
Enter a value:\n
aaaaaENTER
Enter a value:\n
aaaaENTER
Enter a value:\n
aaaENTER
Enter a value:\n
aaENTER
Enter a value:\n
aENTER
Enter a value:\n
aaaaaaaENTER
Enter a value:\n
hello world does this thing Work?ENTER
[0]: AAAAAA <>
[1]: aaaaa\n
[2]: aaaa\n
[3]: aaa\n
[4]: aa\n
[5]: a\n
[6]: AAAAAAA <>
[7]: HELLO WORLD DOES THIS THING WORK? <>





Test Case 2




How many strings?\n
10ENTER
Enter a value:\n
doltishnessENTER
Enter a value:\n
subclassENTER
Enter a value:\n
carbonizedENTER
Enter a value:\n
myxomaENTER
Enter a value:\n
quiringENTER
Enter a value:\n
confutativeENTER
Enter a value:\n
wealdENTER
Enter a value:\n
unerringlyENTER
Enter a value:\n
unpensioningENTER
Enter a value:\n
indagativeENTER
[0]: DOLTISHNESS <>
[1]: SUBCLASS <>
[2]: CARBONIZED <>
[3]: MYXOMA <>
[4]: QUIRING <>
[5]: CONFUTATIVE <>
[6]: weald\n
[7]: UNERRINGLY <>
[8]: UNPENSIONING <>
[9]: INDAGATIVE <>

Jun 06, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here