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
Helen [10]
3 years ago
10

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

es. The input begins with an 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 arrays, one array for the strings and one array for the frequencies.

Computers and Technology
1 answer:
Anastasy [175]3 years ago
4 0

Answer:

See explaination

Explanation:

Below is the program code;

import java.util.Scanner;

public class LabProgram {

public static void main(String[] args) {

Scanner in = new Scanner(System.in);

int n = in.nextInt();

String[] words = new String[n];

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

words[i] = in.next();

}

int count;

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

count = 0;

for (int j = 0; j < words.length; j++) {

if (words[i].equals(words[j])) {

++count;

}

}

System.out.println(words[i] + " " + count);

}

}

}

Please kindly check attachment for the output.

You might be interested in
Under which theory of liability would a severely injured guest who allegedly slipped on some liquid on the floor in your restaur
Vsevolod [243]

Answer:

Negligence

Explanation:

Under the theory of liability, a complainant can file a lawsuit on the basis of negligence, of which borders on the failure of one to exercise his or her legal obligation either by omission or commission.  

The guest who is severely injured after allegedly slipping on some liquid on the floor of my restaurant can file a lawsuit to hold me liable for his injury because of failure to ensure safety of guests in my restaurant.

6 0
3 years ago
Nathan notices his computer system is slowing down when he tries to copy documents to it. He also gets a prompt that warns him t
eduard
Increase your harddisk size
7 0
3 years ago
A rectangular box that displays information or a program is called
vladimir2022 [97]
<span>A rectangular box that displays information or a program is called <em><u>dialog box</u></em></span>
7 0
3 years ago
Write a one-line program to output the following haiku.
Serggg [28]

10 CLEAR: PRINT "A lightning flash: between the forest trees I have seen water.": END

8 0
3 years ago
Read 2 more answers
Which scenario best illustrates the information implementation of data governance?
scoray [572]

Answer:       its a

Explanation:

Trust

6 0
2 years ago
Other questions:
  • File names should describe what is in the file in a few words
    10·1 answer
  • Create one of these on your desktop start menu and use it to quickly open a folder, data file, program, or other object?
    13·1 answer
  • What is one of the first power tools you’ll need as electrician
    15·1 answer
  • What would you use to see what network adapters are installed in your windows computer?
    11·1 answer
  • Write the proghrams for the following:
    13·1 answer
  • Write a function called intersect with four float parameter
    11·1 answer
  • When replacing a system board in a laptop, which feature is a must?
    7·1 answer
  • When looking at security standard and compliance, which three (3) are characteristics of best practices, baselines and framework
    8·1 answer
  • Outline four advantages of digital<br>cameras over analogue cameras​
    6·1 answer
  • HELP ME PLEASE
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!