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
Use ________ resolution when recording human speech in an audio file.
Reil [10]
<span>Use 8-bit resolution when recording human speech in an audio file.
</span><span>The </span>resolution<span> of </span>8 bits<span> can encode an analog input to one in 256 different levels. The reason why 256 levels is because 2^8</span><span> = 256.
</span>The analog to digital converter (ADC) <span> represents the analog input as a digital word.</span>
6 0
3 years ago
Which option correctly identifies if the researcher’s approach was the best choice in the following scenario and explains why?
Tasya [4]

Answer:

A

Explanation:

go do it

4 0
3 years ago
Read 2 more answers
Who can give me answer for this kinda urgent pls
marissa [1.9K]

Answer:

true

Explanation:

it's TRUE the correct answer is true

6 0
2 years ago
Hurry plz
Elanso [62]

Answer: It allows you to locate materials, be aware of your assignments and plan time to get things done.

Hope it helped.

3 0
3 years ago
The Backstage view is where you can see information and options pertaining to the user account and settings. How is the Backstag
Georgia [21]

Answer:b) Mail settings can be changed under the options menu

Explanation: I fr just guessed so y’all can have an answer and I ended up getting it rights

6 0
2 years ago
Other questions:
  • Semiconductor memory is used mainly for primary storage even with its high cost. In another hand, the magnetic tape is the cheap
    6·1 answer
  • #We've started a recursive function below called #measure_string that should take in one string parameter, #myStr, and returns i
    5·1 answer
  • Print either "Fruit", "Drink", or "Unknown" (followed by a newline) depending on the value of userItem. Print "Unknown" (followe
    13·1 answer
  • Was the big blue button thing a good decision or bad?<br> *I think it was a bad idea.
    15·2 answers
  • The chief reason that family and friends are frequent targets of aggression is that
    6·1 answer
  • Object-oriented programs employ a group of techniques for handling errors called ________ handling.
    12·1 answer
  • What steps might a company or organization need take in order to keep its digital data secure online?
    8·1 answer
  • One key feature of malware is that it:
    13·1 answer
  • You have been asked to replace a cracked screen on a laptop. The replacement screen was delivered today, but it did not include
    7·1 answer
  • Which discipline focuses on the design of computer hardware?
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!