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
It's been a really hot summer. Does that mean the climate is changing?.
stiks02 [169]

Answer: No, climate change involves a much longer time period. This is just changing the weather

Explanation: I took the test ! Hopes this help you :)

5 0
2 years ago
How many days do I have to wait to know my FSA score?
katovenus [111]

Answer:

Usually at the end of your school year or the beginning of your next school year

4 0
3 years ago
Read 2 more answers
Use the diagram to complete the statements. Angles 1 and 5 are because they are angles. Angles 4 and 6 are because they are angl
Rzqust [24]

The complete sentences are :

A) Angles 1 and 5 are  <u>Congruent</u>   because they are <u>Corresponding</u> angles

B) Angles 4 and 6 are <u>Supplementary</u> because they are <u>Same-side interior</u> angles

<h3>Determining the relationship between angles</h3>

Angles 1 and 5 are corresponding angles from the diagram and corresponding angles are congruent angles in geometry. while

Angles 4 and 6 are on the same side and are known as same-side interior angles. Summation of angles 4 and 6 add up to 180° therefore they are supplementary angles.

Hence we can conclude that the complete sentences realting to your question are as written above.

Learn more about Angles : brainly.com/question/25770607

7 0
2 years ago
Read 2 more answers
At 900 ∘c,kc=0. 0108 for the reaction caco3(s)←→cao(s)+co2(g) a mixture of caco3, cao, and co2 is placed in a 10. 0-l vessel at
Mrac [35]

The concentration of CaCO3 increases in all cases because Q> K.

<h3>What is equilibrium?</h3>

A chemical reaction is said to have attained equilibrium when the rate of forward reaction is equal to the rate of reverse reaction. We are told that the Kc of the reaction is 0. 0108.

In the first case:

CaCO3 - 15.0 g/100g/mol/10 L = 0.015 M

CaO - 15.0 g/56 g/mol/10 L = 0.027 M

CO2 - 4.25 g/44 g/mol / 10 L = 0.0096 M

Q = [0.027] [0.0096]/0.015

Q = 0.017

Since Q > K, the concentration of CaCO3 increases

In the second case;

CaCO3 -  2.5 g/100g/mol/10 L =0.0025 M

CaO - 25.0 g/56 g/mol/10 L = 0.045 M

CO2 - 5.66 g/44 g/mol / 10 L = 0.013 M

Q = [0.045 ] [ 0.013]/[0.0025 ]

Q = 0.23

Q > K the concentration of CaCO3 increases

In the third case;

CaCO3 - 30.5 g/100g/mol/10 L =0.031 M

CaO - 25.5 g/56 g/mol/10 L =0.046 M

CO2 - 6.48 g//44 g/mol / 10 L = 0.015 M

Q = [0.046] [ 0.015]/[0.031]

Q = 0.022

Q> K hence the concentration of CaCO3 increases

Missing parts: At 900oC, Kc = 0.0108 for the reaction: CaCO3(s) <===> CaO(s) + CO2(g) A mixture of CaCO3, CaO, and CO2 is placed in a 10.0 Liter vessel at 900oC. For the following mixtures, will the amount of CaCO3 increase, decrease, or remain the same as the system approaches equilibrium? CaCO3 CaO CO2 At Equilibrium, CaCO3 will ?? 15.0 g 15.0 g 4.25 g Answer 2.5 g 25.0 g 5.66 g Answer 30.5 g 25.5 g 6.48 g Answer

Learn more about equilibrium: brainly.com/question/17960050

4 0
2 years ago
What is a major difference between the Roman Catholic Church and the Eastern Orthodox Church?
Gnoma [55]

Answer:

The major difference between the Roman Catholic Church and the Eastern Orthodox Church is that the Roman Catholic Church believes the pope is impeccable in affairs relating to the doctrine while the Eastern Orthodox Church discard the papal primacy notion and considers the patriarch to have human nature and capable of being wrong.

Explanation:

Along with the Eastern Orthodox Church, the Protestants churches also have discarded the belief of papal primacy

The other differences are;

1) That the Roman Catholic Church believes that Mary was given birth to without man's original sin, while the Eastern Orthodox Church believed that Mar was purged of the original sin

2) The filioque clause

6 0
3 years ago
Other questions:
  • Emily has upset her father by not quitting smoking. Which is an example of the positive punishment her father uses on Emily?
    11·1 answer
  • What do the Tucks do while they are eating? Choose all answers that are correct. A. talk to each other B. lick their fingers C.
    13·1 answer
  • The amount of interia an object has depends on its
    10·1 answer
  • Top 3 pedestrian errors in traffic crashes in 2016 were
    13·1 answer
  • Anyone has last minute tips for the SAT on saturday?
    11·1 answer
  • I WILL GIVE THE CORRECT PERSON BRAINIEST
    5·1 answer
  • One hundred twenty five thousandths in decimal form
    7·1 answer
  • Write an equation that gives the proportional relationship of the graph.
    6·1 answer
  • How many total atoms are present in 32. 8 grams of cu2s?.
    8·2 answers
  • for making a scatter plot of the data set, which would be the best scale and interval for the axis that represents the amount of
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!