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
How do you install an operating system?<br><br> Answer with full sentences
denis23 [38]

Answer:

On Windows. Insert the installation disk or flash drive. Restart your computer. Wait for the computer's first startup screen to appear. Press and hold Del or F2 to enter the BIOS page. Locate the "Boot Order" section. Select the location from which you want to start your computer.

Explanation:

6 0
3 years ago
A common and extremely useful feature of most online dictionaries is
choli [55]
A common and extremely useful feature of most online dictionaries is <em />interoperable browser.
4 0
3 years ago
Drag each tile to the correct box.
kari74 [83]

Answer:

RESET...

Explanation:

.The file is not Indexed for searches.

.The file can only be viewed.

.The file is ready for backup.

.The file or folder is hidden.

√ Reset

.Next

6 0
3 years ago
Contact Us Save
svetoff [14.1K]
All except drinking caffeinated beverages:)))
3 0
3 years ago
Developers have proposed to build a subdivision near the shore of a lake, but this would require altering a popular wetland area
ad-work [718]
<span>They would argue that a a healthy, sustainable environment is necessary for humans. </span>Anthropocentrism is a belief that <span>interprets or regards the world in terms of human values and experiences. They see things as how they affect humans. They want to preserve the wetland so it could help humans.</span>
3 0
3 years ago
Other questions:
  • Question 1 (True/False Worth 15 points)
    6·1 answer
  • ​this is another name for the wireless configuration in which a central wireless device is used to serve all wireless clients.
    13·1 answer
  • How do you recognize substances that have gone through physical or chemical changes?
    14·2 answers
  • Can someone please help me with the three questions please?
    6·1 answer
  • Which of the following statements is true?A)Implicit data type conversion is performed when you mix values of different data typ
    5·1 answer
  • What type of Microsoft Server serves as an email server?
    7·2 answers
  • If my usb could unlock my computer with a tool then could i be able to open it using ip unlock
    9·1 answer
  • I'm bad i'm mrs puff doo doo doo yeah it's a holiday
    6·2 answers
  • Refund please, this has not helped at all.
    6·2 answers
  • Continue your S3 and S4 assignment for a young soccer league with the following specification. Do not include the previous queri
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!