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
shepuryov [24]
3 years ago
8

Implement the function calcWordFrequencies() that uses a single prompt to read a list of words (separated by spaces). Then, the

function outputs those words and their frequencies to the console.
Ex: If the prompt input is:

hey hi Mark hi mark
the console output is:

hey 1
hi 2
Mark 1
hi 2
mark 1
Computers and Technology
1 answer:
Novosadov [1.4K]3 years ago
5 0

Answer:

JavaScript code is given below

Explanation:

function calcWordFrequencies() {

   var words = prompt("Enter the sentence below").split(" ");

   var unique_words = [], freqencies = [], count = 0;

   for (var i = 0; i < words.length; i++) {

       var found = false;

       for (var j = 0; j < count; j++) {

           if (words[i] === unique_words[j]) {

               freqencies[j] = freqencies[j] + 1;

               found = true;

           }

       }

       if (!found) {

           unique_words[count] = words[i];

           freqencies[count] = 1;

           count++;

       }

   }

   for (var i = 0; i < words.length; i++) {

       var result = 0;

       for (var j = 0; j < count; j++) {

           if (words[i] === unique_words[j]) {

               result = freqencies[j];

               break;

           }

       }

       console.log(words[i] + " " + result);

   }

}

You might be interested in
Python comes with ________ functions that have been already prewritten for the programmer.
Gnoma [55]
Python comes with built-in functions...
6 0
3 years ago
Rheneas wants to ensure his management team is aware of the common causes for failed enterprise system implementations before th
Vaselesa [24]

Rheneas will inform to the team that (c) the failure rate for ERP implementations worldwide is 21 percent.

<h3>Definition of ERP?</h3>

ERP or Enterprise Resource Planning is a software which organizations use to manage business activities, for example: accounting, risk management and compliance,  procurement, project management, and supply chain operations. ERP core is to automate the internal business process on the organisazations by drawing central database and control the process based on input from the organisazation divisions. There is five main component on the ERP as follow:

  1. Finance
  2. Supply Chain Management (SCM)
  3. Customer Relationship Management (CRM)
  4. Human Resources (HR)
  5. Manufacturing and logistics

Learn more about ERP at brainly.com/question/29426906

#SPJ4

4 0
1 year ago
If you use the Justified option for a paragraph, the lines of text will __________.
saul85 [17]
The answer should be option A "<span>all be of equal length and line up at both margins." The justified option on Microsoft Word lines up the words at both margins, mainly used for types of writings and helped make the writing more neater or organized.

Hope this helps!</span>
5 0
3 years ago
Which option correctly identifies the expense that will cost you the most when you are living on your own?
larisa86 [58]
Cccccccccccccccccccccc
5 0
4 years ago
Create the algorithms in both flowchart and pseudocode form for the following two program requirements:
Zarrin [17]

Answer:

Hello Brissap2814! This question has 3 parts. The first is asking you to print the highest price from an array of 100 prices. The easiest way to do this is to sort the array in ascending order, so that the highest value of the array becomes the last array element, which you can then simply print to the screen. The second part of the question is asking you to reduce the highest price that you got in the first part of the answer by 10%. Finally, the last part of the question is asking you to prompt a user to input 3 numbers and then print the numbers in ascending order. The requirements are to provide both Flowchart and Pseudocode algorithms for all 3 parts.  

Explanation:

1. Print highest price from array prices

 Algorithm: Pseudocode  

    highest_price = prices.sort.last

      OR    

    highest_price = prices.sort[100]

2.

 Algorithm: Pseudocode    

   reduced_price = highest_price – 10%  

   prices[100] = reduced_price

3.

 Algorithm: Pseudocode    

   // initialize empty array  

   input_array = []  

   // loop 3 times    

   for count in 0..2    

      prompt user input for number    

      handle exceptions for non-numeric input    

      save user input to input_array  

    end  

    // sort input array  

    input_array.sort  

    print input_array  

4 0
3 years ago
Other questions:
  • Q3** Write a query to create a new price list for books written by the same author. Allow the user to enter only the first 4 let
    15·1 answer
  • Which of the following commands uses correct syntax for matching the patterns bunk or bank at the end of a line of text?
    5·1 answer
  • you want to search in your contacts in your email program. You enter the person's first name and last name in the search box. Yo
    8·1 answer
  • One of the most obvious initial changes in windows vista is the ____ interface
    10·1 answer
  • How might your use of computers and knowledge after technology systems affect your personal and professional success
    5·1 answer
  • 2(x-5)-3(3-x)=1/2(x-2)
    9·1 answer
  • According to the video, what are some hazards Stationary Engineers may face? Check all that apply. noise, hazardous materials, d
    7·2 answers
  • A technician has been told that a keyboard is not responding at all. What can the technician do quickly to determine whether tha
    9·1 answer
  • There are main type of memory
    7·1 answer
  • Which is NOT one of the basic characteristics of life? What feature of Microsoft
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!