1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Iteru [2.4K]
3 years ago
15

Write a static method, getBigWords, that gets a single String parameter and returns an array whose elements are the words in the

parameter that contain more than 5 letters. (A word is defined as a contiguous sequence of letters.) EXAMPLE: So, if the String argument passed to the method was "There are 87,000,000 people in Canada", getBigWords would return an array of two elements, "people" and "Canada". ANOTHER EXAMPLE:__deletedc942e16469dfc985bad93686bef33709ea1d39aa11de399983e1c15bed9d613adeleted__", getBigWords would return an array of three elements, "request", "support" and "turingscraft".
Computers and Technology
1 answer:
ZanzabumX [31]3 years ago
7 0

Answer:

import java.util.*;

public class Solution {

   public static void main(String args[]) {

       Scanner scan = new Scanner(System.in);

       System.out.println("Enter the words.");

       String userInput = scan.nextLine();

       

       String[] splitedString = userInput.split(" ");

       getBigWords(splitedString);

       

   }

   

   public static void getBigWords(String[] listOfWord){

       ArrayList<String> list = new ArrayList<String>();

       

       for(int i = 0; i < listOfWord.length; i++){

           if(listOfWord[i].length() > 5){

               list.add(listOfWord[i]);

           }

       }

       

       for (String temp : list) {

  System.out.println(temp);

 }

   }

}

Explanation:

The first line is the import statement which import the classes needed for this class: Scanner and ArrayList.

The class was defined as Solution. Then, the main method is defined. Inside the main method a scanner object is created called scan to receive user input.

The user is prompted for input, which is stored as userInput. The userInput is then splitted and stored in an array called splitedString.

The method that perform the string manipulation is called getBigWords, the method take the splittedString as a parameter.

Next, the getBigWords method is defined; it takes an array as parameter. The parameter is called listOfWord. Inside the getBigWords method, an ArrayList called list is initialized. The list is to hold string whose length is more than 5.

The first for-loop loop through the listOfWord and check if any element has length greater than 5. If there is, the element is added to the list arraylist.

The second for-loop loop through the list to output the words whose length is greater than 5.

You might be interested in
Two strategies for keeping your files in sync
zlopas [31]

Answer:

1. MS Cloud

2. G Drive

Explanation:

5 0
3 years ago
How do you change the desktop background in the macos mojave operating system?
sleet_krkn [62]

Answer: Click the System Preferences icon on the dock. In the first row, click Desktop & Screen Saver.

Explanation: When it comes to macOS versions, Mojave and High Sierra are very comparable. The two have a lot in common, unlike Mojave and the more recent Catalina.

8 0
1 year ago
Where should you look in order to find words as they are used in a variety of contexts?
Elodia [21]
You'd want to look at the <span>glossary.</span>
8 0
3 years ago
Ultimately, there exists a ceiling on efficiency because _______________.
earnstyle [38]
Thank you for posting your question here at brainly. I hope the answer will help you. Feel free to ask more questions.
Among the choices above the answer is C which is <span>of government taxation


To complete the sentece "</span>Ultimately, there exists a ceiling on efficiency because of government taxation
5 0
3 years ago
In a game with three frames, where will the objects on Layer 1 appear?
Ivan
It’s between d or c
6 0
3 years ago
Read 2 more answers
Other questions:
  • An automobile battery, when connected to a car radio, provides 12.5 V to the radio. When connected to a set of headlights, it pr
    11·1 answer
  • Markup is best defined as
    11·1 answer
  • What does a wholesaler do?
    12·1 answer
  • Which task can a company perform with intranets
    8·1 answer
  • Choose the parts of the browser window. PLEASE ANSWER QUICKLY TEST
    12·2 answers
  • Henry has created a software product that manages a database of company clients. He wants to install the software on a client's
    13·1 answer
  • Please helpppppppppppppppppp please I’m stuck!
    15·1 answer
  • ASAP PLS HELP: I’ll give brainliest if you u answer them all correctly!!
    12·2 answers
  • What is the second row of letters in the keyboard called?
    6·1 answer
  • So I tried asking for help with my code on stackoverflow but the people there were very condescending and mean plus my questions
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!