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
When students have computer trouble they usually are expected to
Kitty [74]

Answer: A) Make any simple fixes on their own.

5 0
3 years ago
Read 2 more answers
Thomas owns a small Web services company and currently owns and maintains all his own computing hardware. He plans to develop an
Stels [109]

Answer: Hello the options related to your question is missing attached below are the options

answer : unlimited computing capacity for a low monthly fee ( A )

Explanation:

Since Thomas plans to develop a new service that will require his computing capacity to either double or triple, The best way of transitioning to the public cloud that might help Thomas meet up the requirement is Using unlimited computing capacity for a low monthly fee

7 0
3 years ago
The “Fix a Problem” section of About.com’s PC support page provides information on Reversing Damages and (blank) plss help its t
Lera25 [3.4K]

Answer:

Mistakes

Explanation:

What are the three main technical support options for Microsoft users. Find It Myself, Ask the Community, <u>The "Fix a Problem" section of About.com's PC support page provides information on Reversing Damages and </u><u>MISTAKES.</u>

4 0
3 years ago
Read 2 more answers
Assume you have a subdirectory named datafiles directly under your current working directory, and you have two files named data1
Natasha_Volkova [10]

Answer:

Follows are the command which is used to copy file data:

CP data1 to data2 datafiles

Explanation:

In the above-given command code, we use the CP command, which is part of the Linux. In this command, we use  CP that stands for copying data1 file to data2 file for copying, and for the files to be pasted. This command also uses the "datafiles", which is used to provide the relative final destination path.

4 0
3 years ago
What are the different types of interaction in nature ?????????​
densk [106]

mutualism, commensalism, competition and predation

7 0
3 years ago
Other questions:
  • Web client software, such as Chrome, Firefox, Internet Explorer, Safari, and Opera, that are used to view Web pages are known as
    14·2 answers
  • With a patent on drug Z27, why would Able Drug Company charge customers $7 per 100 units even though its cost of producing 100 u
    5·2 answers
  • I need help making a survey for highschool students in my school any topics/questions?
    9·1 answer
  • Troubleshooting a printer that does not work includes a. connecting the printer to your computer b. checking to see if there is
    13·1 answer
  • What is the benefit to displaying the merge codes in a document?
    9·1 answer
  • Use the following cell phone airport data speeds​ (Mbps) from a particular network. Find P10. 0.1 0.1 0.3 0.3 0.3 0.4 0.4 0.4 0.
    7·1 answer
  • 11.The shortcut keys used to center a paragraph are&lt;br /&gt;a. CTRL+T&lt;br /&gt;b. CTRL+M&lt;br /&gt;c. CTRL+SHIFT+T d. CTRL
    7·1 answer
  • When you're working on an image, it's a good idea to make a ____________ of the image, so that you'll have the original image in
    12·2 answers
  • 29 POINTS!!!
    6·1 answer
  • Suppose testcircle1 and circle1 in listing 9.1 are in two separate files named testcircle1.java and circle1.java, respectively.
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!