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
Ilia_Sergeevich [38]
2 years ago
11

java Write a program that reads a list of words. Then, the program outputs those words and their frequencies. The input begins w

ith an integer indicating the number of words that follow. Assume that the list will always contain less than 20 words.
Computers and Technology
1 answer:
vfiekz [6]2 years ago
6 0

Answer:

The following are the program in the Java Programming Language.

//set a package

import java.util.Scanner;

//define class

public class Main  

{

 //define a main method

 public static void main(String[] args)  

 {

   //declare the Scanner class object

   Scanner s = new Scanner(System.in);

   //get the size of the array from the user

   int size=s.nextInt();

   //declare an integer array with given size

   int a[]=new int[size];

   //declare a string array with given size

   String word[]=new String[size];

   //set the for loop  

   for(int i=0;i<size;i++)

   //get string input from the user

   word[i]=s.next();

   //iterates with the array, increase the count

   for(int i=0;i<size;i++)  

   {

     for(int j=0;j<size;j++)  

     {

       //check that elements of words

       if(word[i].equals(word[j]))

         //increament in the array by 1

         a[i]++;

     }

   }

   System.out.print("\n");

   //set for loop to print the following result

   for(int i=0;i<size;i++)

     System.out.println(word[i]+" "+a[i]);

  }

}

Explanation:

<u>The following are the description of the program</u>.

  • Firstly, set the required predefined package and define class 'main then, define main method inside the class and inside the method.
  • Declare the object of the scanner class and get the size of the array through the object in the variable 'size'.
  • Then, declare two array which are integer type 'a' with the given input size and string type 'word' with the given input size.
  • Set the for loop that get string type array elements from the user and again set two for loop that increase the size of the integer data type array by 1 with the loop iteration.
  • Finally, set the for loop that print the following result.
You might be interested in
Which language paradigm interacts well with database systems in business environments that use SQL?
HACTEHA [7]
The answer is C, can you mark me brain
6 0
3 years ago
You want to divide the value in cell D3 by the value in cell E3. Which formula should you use?
Tom [10]
The formula is:
=D3/E3
4 0
3 years ago
Read 2 more answers
Which option in the file menu will open a blank document?
artcher [175]

The answer is click on new

5 0
3 years ago
A custom information field that helps users to find a specific document is called
Vlada [557]
Database, a collection of information, basically an electronic filing system.. it helps users to <span>quickly </span><span>select and </span>find a desired pieces of data.
3 0
3 years ago
Read 2 more answers
Lenny is working as an apprentice to a typesetter. He has been told to sort different font stamps based on their type. Match the
DedPeter [7]

Answer:

Serif without kerning is the first one

Italic is the second one

Bold is the third one

Serif with kerning is the fourth one

Explanation:

I had this question and got this correct

3 0
2 years ago
Other questions:
  • The purpose of the ________ element is used to configure the main content of a web page document.
    5·1 answer
  • Commercial applications are never free<br><br> -True<br><br> -False
    9·1 answer
  • Each cout statement has a syntax error. Type the first cout statement, and press Run to observe the error message. Fix the error
    11·1 answer
  • All web page urls begin with the letters ____.
    6·1 answer
  • Which screen should be open to customize or personalize a desktop background?
    15·2 answers
  • Write a program that passes an unspecified number of integers from command line and displays their total.
    5·1 answer
  • Is anyone a robIox moderator?
    13·2 answers
  • The cost to ship a package is a flat fee of 75 cents plus 25 cents per pound. 1. Declare a const named CENTS_PER_POUND and initi
    12·1 answer
  • to allow excel to change the cell references in a formula or function from row to row or column to column as you fill with it, y
    13·1 answer
  • Discuss new concepts that you have learned about Cisco Devices and how they will be helpful in the workplace.
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!