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
Keith_Richards [23]
3 years ago
10

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

n integer indicating the number of words that follow. Assume that the list will always contain fewer than 20 words. Ex: If the input is: 5 hey hi Mark hi mark the output is: hey - 1 hi - 2 Mark - 1 hi - 2 mark - 1 Hint: Use two vectors, one vector for the strings and one vector for the frequencies.
Computers and Technology
1 answer:
tekilochka [14]3 years ago
5 0

Answer:

The following are the program to the given question:

import java.util.*;//import package for user input

public class Make  //define class Make

{

public static void main(String[] ask)  //define a main method

{

  Scanner obx = new Scanner(System.in);   //declare the Scanner class object

  int size=obx.nextInt(); //get the size of the array from the user

  int a[]=new int[size]; //declare an integer array with given size

  String word[]=new String[size]; //declare a string array with given size

  for(int i=0;i<size;i++) //set the for loop  

  word[i]=obx.next(); //get string input from the user

  for(int i=0;i<size;i++)   //iterates with the array, increase the count

  {

    for(int j=0;j<size;j++)   //defining a loop to check value

    {

      if(word[i].equals(word[j]))  //use if to check that elements of words          

      a[i]++;//increamenting array size

    }

  }

 System.out.print("\n");  //use print for break line  

  for(int i=0;i<size;i++)//set for loop to print the following result

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

 }

}

Output:

Please find the attachment file.

Explanation:

  • First, establish the predefined package required and instead define the main class and define the main method within the class and method.
  • Declare the scanner class object and receive an object size in the 'size' variable thru the array.
  • Next create two arrays, the integer type "a" with both the input size given and the string type "word" with the input size supplied.
  • Define the loop for which string array elements are acquired and set two to again for loop, which increases with loop iteration the integer data type array by one.
  • Lastly, set the loop for which this result is printed.

You might be interested in
Networking and telecommunications technologies, along with computer hardware, software, data management technology, and the peop
Delvig [45]

Answer:

Option d  Information system

Explanation:

Information system is a system used by an organization to organize and analyze data. The main function of the information system is to generate useful information from the organized data to drive for decision making in an organization. An information system can includes components such as computer hardware, software, network and also the human resources required to manage and implement the system. All these components work together to form a functional information system for an organization.

7 0
3 years ago
How to search multiple microsoft word documents?
attashe74 [19]
There is usually a check mark box on the left hand side upper corner of your document click it and any other document you want to open by that
8 0
3 years ago
Read the four detective reports and the combined affidavit and warrant for the M57 Patents case. Write a one- to two-page paper
Fantom [35]

Answer:The 2009-M57-Patents scenario tracks the first four weeks of corporate history of the M57 Patents company. The company started operation on Friday, November 13th, 2009, and ceased operation on Saturday, December 12, 2009. As might be imagined in the business of outsourced patent searching, lots of other activities were going on at M57-Patents.

Two ways of working the scenario are as a disk forensics exercise (students are provided with disk images of all the systems as they were on the last day) and as a network forensics exercise (students are provided with all of the packets in and out of the corporate network). The scenario data can also be used to support computer forensics research, as the hard drive of each computer and each computer’s memory were imaged every day.

Explanation:

4 0
3 years ago
You can merge the cells using the rowspan and colspan attribute of the tag <br> true or false​
Travka [436]

Answer: True.

Explanation: ...

3 0
2 years ago
Care and feeding for computer
o-na [289]
Don’t drop it and charge it regularly
5 0
3 years ago
Other questions:
  • This provides an easy method for workers to use their computers.
    11·2 answers
  • Who has access to the source code of proprietary software
    6·1 answer
  • Define a function below, sum_numeric_vals, which takes a single dictionary as a parameter. The dictionary has only strings for k
    12·1 answer
  • Which component of the windows desktop allows you to retrieve files that have recently been deleted?
    11·1 answer
  • ____________________ is the primary code humans use to communicate. (Points : 1
    9·1 answer
  • Bruh my sister does bot understand what this means
    6·1 answer
  • A trackerball is a pointing device
    9·1 answer
  • Place the steps in order for creating a Custom Search Folder in Outlook 2016.
    9·2 answers
  • (b) In Scratch, the instruction 'when I receive' enables us to _____ the action of multiple sprites ​
    5·1 answer
  • 5. What skill is unique to reading online?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!