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
HELP!!!
aleksley [76]

Answer:

The detail answer of this question is given in explanation section.

The simple answer is option B

Explanation:

Let took at each option:

A) an html tag

An html tag is used to start and end html document. It does not have anything to do with rendering.

B) a doctype declaration

The document type declaration is necessary because it tell the browser which version of html should be rendered.

C)Body tag tell the browser. it is the visible area of website.

D) A hear tag is used to clear meta data about website.

3 0
2 years ago
Read 2 more answers
modify hw 02 c.c to use envp instead of environ. be sure that you understand how the code works. provide liberal comments to exp
rjkz [21]

With the aid of pointer-based arithmetic operations and the usage of pointers in comparison operations, address arithmetic is a technique for determining the address of an object. Pointer arithmetic is another name for address arithmetic.

The pointers can be used for mathematical operations like addition, subtraction, etc. The outcome of an arithmetic operation on the pointer, however, will likewise be a pointer if the other operand is of type integer because we know that the pointer includes the address. These operations are addition and subtraction. In C++, a pointer's value can be increased or decreased. It signifies that we can change the pointer's value by adding or removing integer values. A pointer arithmetic can be subtracted (or added) from another in a manner similar to this.

Learn more about arithmetic here-

brainly.com/question/11424589

#SPJ4

4 0
1 year ago
explain the joke, “There are 10 types of people in the world: those who understand binary and those who don’t.”
tino4ka555 [31]

Answer:

Binary is made up of only 2 digits: a one and a zero. 1011 is eleven in our counting system.

So 10 in binary = 2 in our counting system.

Read the joke as follows. There are 2 types of people in the world: those who  understand binary and those who do not.

I guess it's not really that funny, but computer programmers like it.

6 0
8 months ago
In which way is a worm different from a virius
dangina [55]
A worm as a multicell organism, but a virus is a single cell.
3 0
3 years ago
What game is the best for racing and modifying cars
sleet_krkn [62]

Answer:  it is Forza Horizon 4. ...

Best Car Games

1.Forza Horizon 4

2. Grand Theft Auto V

3. Need For Speed Payback

4. Car Mechanic Simulator

5. Forza Horizon 4

6. Rocket League

Explanation:

6 0
2 years ago
Other questions:
  • Describe the Say It, Cover It, Resay It method.
    14·2 answers
  • Tricia listed her assets and liabilities. Credit Card Bill Car Loan Bonds Piano Bank Account Bicycle Which are Tricia’s liabilit
    8·2 answers
  • Why is self-esteem important in self-representation
    7·1 answer
  • A ____ is a collection of computers and users that are identified by a common security database. workgroup controller segment do
    7·1 answer
  • A technician mistakenly uninstalled an application that is crucial for the productivity of the user.
    6·1 answer
  • A resistor bank is connected to a controller with conductor insulation rated 75 °C. The resistors are not used in conjunction wi
    15·1 answer
  • Define a method printFeetInchShort, with int parameters numFeet and numInches, that prints using ' and " shorthand. End with a n
    7·2 answers
  • What is an advantage and disadvantage to file compression
    8·1 answer
  • Que significa el término Informática?
    6·1 answer
  • HELP ASAP
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!