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
What is software infrastructure?
Setler79 [48]
Software-defined infrastructure (SDI) is the definition of technical computing infrastructure entirely under the control of software with no operator or human intervention. It operates independent of any hardware-specific dependencies and are programmatically extensible.
4 0
3 years ago
How can you use the Address Book to address an email message? Use the drop-down menus to complete the sentences. 1. Type an emai
Delvig [45]

Answer:

1. AutoCorrect

2. Address book

Explanation:

stan bts ?

5 0
3 years ago
Read 2 more answers
What are the value and data type (float, int, bool, or str) of this expression:<br><br> 5 % 2
amm1812

Answer: float

Explanation:

This is asking what would the remainder be of 5/2. I am not totally sure what you are asking but float is used with remainders because it could have a decimal like 3.33 that would throw an error for anything other than float.

3 0
2 years ago
Which if the following is an example of tangible property?
lutik1710 [3]
It may have been a songlyrics
7 0
2 years ago
Write an If...Then statement that assigns 0 to intX when intY is equal to 20
BigorU [14]

Answer:

wh,,what?

Explanation:

3 0
3 years ago
Read 2 more answers
Other questions:
  • To maintain audience interest in a multimedia presentation, use animations or transition features to control when objects or tex
    13·1 answer
  • Write a class named Car that has the following member variables: - yearModel. An int that holds the car’s year model. - make. A
    6·1 answer
  • The Status bar is used to control the majority of the drafting settings in AutoCAD
    13·1 answer
  • Where is the typical location of a touchpad inside of a laptop?
    13·1 answer
  • Which skill type refers to the knowledge and ability to perform a task?
    13·2 answers
  • How do i delete an account for brainly how do i delete everything
    7·2 answers
  • Several NEC® sections contain the requirement to size conductors and overcurrent devices at 100 percent of the noncontinuous loa
    15·1 answer
  • Why are medical related professions and human resources important? ​
    8·1 answer
  • Please help me what is an example of a growing trend on social media
    9·1 answer
  • Question 6 options: This is a category or partitioned group of the small units of a programming language include its numeric lit
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!