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
Alla [95]
4 years ago
7

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 less than 20 words.
Engineering
1 answer:
Romashka [77]4 years ago
7 0

Answer:

import java.util.HashMap;

import java.util.Map;

import java.util.Scanner;

public class FrequencyOfWords

{

   public static void main(String[] args)

   {

       Scanner in = new Scanner(System.in);

 

       System.out.println("Enter the integer indicating the number of words");

 

       int n = in.nextInt();

       System.out.println("Enter the string");

       

     

       String[] words = new String[n];

       

       for(int i = 0; i < n; ++i)

       {

           words[i] = in.next();

       }

       Map<String, Integer> map = new HashMap<>();

       

       for(int i = 0; i < n; ++i)

       {

           if(!map.containsKey(words[i]))

           {

               map.put(words[i], 0);

           }

           map.put(words[i], map.get(words[i])+1);

       }

       for(Map.Entry<String, Integer> entry : map.entrySet())

       {

           System.out.println(entry.getKey() + " " + entry.getValue());

       }

   }

}

You might be interested in
A pump of a water distribution system at 25°C is powered by a 15 kW electric motor whose efficiency is 90 percent. The water flo
IRISSAK [1]

The friction loss in the system is 3.480 kilowatts.

<h2>Procedure - Friction loss through a pump</h2><h2 /><h3>Pump model</h3><h3 />

Let suppose that the pump within a distribution system is an open system at steady state, whose mass and energy balances are shown below:

<h3>Mass balance</h3>

\dot m_{in}-\dot m_{out} = 0 (1)

\dot m_{in} = \frac{\dot V_{in}}{\nu_{in}} (2)

\dot m_{out} = \frac{\dot V_{out}}{\nu_{out}} (3)

<h3>Energy balance</h3>

\eta \cdot \dot W_{el} + \dot m_{in}\cdot (h_{in}-h_{out}) - \dot W_{f} = 0 (4)

Where:

  • \dot m_{in} - Inlet mass flow, in kilograms per second.
  • \dot m_{out} - Outlet mass flow, in kilograms per second.
  • \dot V_{in} - Inlet volume flow, in cubic meters per second.
  • \dot V_{out} - Outlet volume flow, in cubic meters per second.
  • \nu_{in} - Inlet specific volume, in cubic meters per kilogram.
  • \nu_{out} - Outlet specific volume, in cubic meters per kilogram.
  • \eta - Pump efficiency, no unit.
  • \dot W_{el} - Electric motor power, in kilowatts.
  • h_{in} - Inlet specific enthalpy, in kilojoules per kilogram.
  • h_{out} - Outlet specific enthalpy, in kilojoules per kilogram.
  • \dot W - Work losses due to friction, in kilowatts.

<h3>Data from steam tables</h3>

From steam tables we get the following water properties at inlet and outlet:

Inlet

p = 100\,kPa, T = 25\,^{\circ}C, \nu = 0.001003\,\frac{kJ}{kg}, h = 104.927\,\frac{kJ}{kg}, Subcooled liquid

Outlet

p = 300\,kPa, T = 25\,^{\circ}C, \nu = 0.001003\,\frac{kJ}{kg}, h = 105.128\,\frac{kJ}{kg}, Subcooled liquid

<h3>Calculation of the friction loss in the system</h3>

If we know that \dot V_{in} = 0.05\,\frac{m^{3}}{s}, \nu_{in} = 0.001003\,\frac{m^{3}}{kg}, h_{in} = 104.927\,\frac{kJ}{kg}, h_{out} = 105.128\,\frac{kJ}{kg}, \eta = 0.90 and \dot W_{el} = 15\,kW, then the friction loss in the system is:

\dot W_{f} = \frac{\dot V_{in}}{\nu_{in}}\cdot (h_{in} - h_{out}) + \eta \cdot \dot W_{el}

\dot W_{f} = \left(\frac{0.05\,\frac{m^{3}}{s} }{0.001003\,\frac{m^{3}}{kg} } \right)\cdot \left(104.927\,\frac{kJ}{kg}-105.128\,\frac{kJ}{kg}\right) + (0.90)\cdot (15\,kW)

\dot W_{f} = 3.480\,kW

The friction loss in the system is 3.480 kilowatts. \blacksquare

To learn more on pumps, we kindly invite to check this verified question: brainly.com/question/544887

6 0
2 years ago
A 1.8-m3 rigid tank contains water steam at 220oC. One-third of the volume is in the liquid phase and the rest is in the vapor f
svetoff [14.1K]

Answer:

a) 2319.6 kPa

b) 0.027

c) 287.86 kg/m^3

Explanation:

The pressure is determined from table  in the appendix for the given temperature:  

 P_220=2319.6 kPa

to calculate the quality we need to determine the masses of the vapor and the liquid and for that we need the respective specific volumes which can also be found in table.  

m_liq  = V_liq/α_liq

           = 504.2 kg

m_vap = V_vap/α_vap

            = 13.94 kg

        q = m_vap/m_liq

          = 0.027

Finally, the density is simply calculated as follows:  

        p = m_tot/V_tot

           = 518.14 kg/1.8 m^3

           = 287.86 kg/m^3

8 0
3 years ago
An isothermal CSTR with a first order irreversible reaction A â&gt; B (and rA[mol/(ft3*min)] = - 0.5 CA) has a constant flow rat
worty [1.4K]
Can you help me by solving this question

7 0
3 years ago
Which of the following explains the purpose of a convertible screwdriver?
aliya0001 [1]

Answer:

The correct option is;

To be able to switch between different heads quickly and easily

Explanation:

A screwdriver is a tool or device that has a grip handle which surrounds an extension shaft that has a forged tip that fits into the complementary groove  on a screw head such that by turning the handle while the forged head of the screwdriver sits in a screw head, the screw is turned

A convertible screw driver is built with the capability to easily change the tip or other attributes of the screwdriver quickly.

7 0
3 years ago
What is
Yuri [45]

Answer:

1

Explanation:

because every time you dived a number by its own number it is 1

6 0
2 years ago
Read 2 more answers
Other questions:
  • To reduce the drag coefficient and thus improve the fuel efficiency of cars,the design of side rearview mirrors has changed dram
    11·1 answer
  • The gradual and uniform cooling of glass that has been heated in order to relieve random internal stresses is... Group of answer
    5·1 answer
  • A refrigerator removes heat from a refrigerated space at 0°C at a rate of 2.2 kJ/s and rejects it to an environment at 20°C. wha
    15·1 answer
  • The increasing interconnections of peoples and countries around the world is known as ________.
    14·2 answers
  • An automobile having a mass of 900 kg initially moves along a level highway at 100 km/h relative to the highway. It then climbs
    7·1 answer
  • In a reversible process both the system and surrondings can be returned to their initial states. a)-True b)-False
    14·1 answer
  • Design a solid steel shaft to transmit 14 hp at a speed of 2400rpm f the allowable shearing stress is given as 3.5 ksi.
    10·1 answer
  • Can someone please do this for me ive been sick for the past week and am behind
    6·1 answer
  • If a certified LEED professional is primarily concerned with existing structures, then which specific professional certification
    15·1 answer
  • When did michael faraday invent wind powered electrical generation?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!