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
liubo4ka [24]
2 years ago
9

2.17 LAB: Word frequencies - methods Write a program that reads a list of words. Then, the program outputs those words and their

frequencies. The input begins with an integer indicating the number of words that follow. Assume that the list will always contain less than 20 words.
SAT
1 answer:
pickupchik [31]2 years ago
3 0

Using the knowledge in computational language in JAVA it is possible to write a code that reads a list of words.

<h3>Writting the code in JAVA:</h3>

<em>import java.util.*;</em>

<em>//class name LabClass</em>

<em>public class LabClass{</em>

<em>    //function getFrequencyOfWord with array wordList, ListSize and currWord as parameter</em>

<em>    public static int getFrequencyOfWord(String[] wordsList, int ListSize, String currWord){</em>

<em>        int frequency = 0;</em>

<em>        //for loop for iteration </em>

<em>        for(int i=0; i<ListSize; i++){</em>

<em>            //if current word matches with words present in list</em>

<em>            //then increase the frequency by 1</em>

<em>            if(wordsList[i].compareTo(currWord)==0){</em>

<em>                frequency++;</em>

<em>            }</em>

<em>        }</em>

<em>        //return frequency at last </em>

<em>        return frequency;</em>

<em>    }</em>

<em>    //main function </em>

<em>    public static void main(String[] args) {</em>

<em>        //creating object of Scanner class </em>

<em>        Scanner sc = new Scanner(System.in);</em>

<em>        int size;</em>

<em>        //asking user to input size of list </em>

<em>        System.out.println("Enter the size of list :");</em>

<em>        size = sc.nextInt();</em>

<em>        //creating array of same size as user input size</em>

<em>        String[] wordList = new String[size];</em>

<em>        sc.nextLine();</em>

<em>        //asking user to input array elements </em>

<em>        System.out.println("Enter list elements one by one :");</em>

<em>        for(int i =0; i<size; i++)</em>

<em>        {</em>

<em>            wordList[i] = sc.nextLine();</em>

<em>        }</em>

<em>        System.out.print("\n");</em>

<em>        sc.close();</em>

<em>        //calling function getFrequencyOfWord in every iteration by passing</em>

<em>        //required arguments to it </em>

<em>        for(int i=0; i<size; i++)</em>

<em>        {</em>

<em>            String currWord = wordList[i];</em>

<em>            int count = getFrequencyOfWord(wordList, size, currWord);</em>

<em>            //printing result </em>

<em>            System.err.println(currWord + " : " + count);</em>

<em>        }</em>

<em>    }</em>

<em>}</em>

See more about JAVA at brainly.com/question/12978370

#SPJ1

You might be interested in
In her article "Why Should I Vote?" Stephanie Goggin crafts a well-organized and coherent argument. She states that every person
Alexeev081 [22]

The Answer Is evaluation of evidence

5 0
2 years ago
Read 2 more answers
In order to get good results in relation to observing water pressure at fixtures, it is good inspection procedural practice to i
Lana71 [14]

In order to get good results in relation to observing water pressure at fixtures, it is good inspection procedural practice to inspect the plumbing fixtures at the "pressure gauges"

<h3>What is plumbing fixtures?</h3>

Plumbing fixtures are the devices that can be linked with a plumbing system to deliver fluid or drain it.

<h3 />

It is common practice for these system to be fitted with a pressure gauges.

Learn more about plumbing fixtures at;
brainly.com/question/12713589
#SPJ1

6 0
1 year ago
Guidewords are located at the bottom of a dictionary page.
tensa zangetsu [6.8K]

Answer:

Why are you giving us the answer..?

3 0
3 years ago
Read 2 more answers
SAT Vocab
Brut [27]

Answer:

[See Below]

Explanation:

________________________

✦ Abstemious - Moderate in eating and drinking.  

✦ Repose - State of rest.

✦ Omnivorous - Eating any kind of food.

✦ Disparate - Different.

✦ Redolent - Nice smelling.

________________________

1.)

  • Disparate

2.)

  • Abstemious

3.)

  • Redolent

4.)

  • Repose

5.)

  • Omnivorous

________________________

~<em>Hope this helps Mate. If you need anything feel free to message me. </em>

-Your~ Friendly~ Answerer, ~Shane<em> ☺</em>

3 0
2 years ago
Value of engagement ring in a woman's life?​
MAVERICK [17]

Answer:

It means a lot to them!

Explanation:

an engagement ring to a woman is a symbol of their dedication, love, and commitment to each other. It is a symbol of the beautiful journey that two people embark upon when they decide to spend their lives together. ... Wearing the engagement ring on this finger became a symbol of the heart and the love that flowed between a married couple.

3 0
3 years ago
Other questions:
  • From the mousetrap book
    6·2 answers
  • Why is the answer for 23 C?<br><br>and why isn't it D?​
    5·1 answer
  • I need a job and i want this to be well written but i’m incapable of eloquently doing so
    15·2 answers
  • Meet at tutoring for high school completion ​
    14·1 answer
  • McDonalds reports that 15% of their workers are under 18 years old. The best shifts for those under 18 is from
    11·1 answer
  • Christianity is the number one religion in Western Europe. _______ is number two. Question 3 options: Pagan (traditional polythe
    5·1 answer
  • Radio stations identify themselves by their position on the radio dial such as 90. 1 and 93. 3. This number is based on the numb
    11·1 answer
  • Which of the following statements best describes the impact of improvements in transportation systems on agriculture?.
    5·1 answer
  • This figure shows the interaction of groundwater with lakes, rivers, and other bodies of water on the surface. Drag the descript
    11·1 answer
  • Type your response in the box. Fill in the table by briefly defining each term that was part of Enlightenment thinking. Then, ex
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!