How to count common words in a file.

timer Asked: Nov 19th, 2014

Question description

So here is the program I have to complete:

Homework 7 asks you to write a program to find out how many words in a file are among the most common words in the english language. I am providing a file with the 1000 most common english words in alphabetic order (1000words.txt).

Your program will prompt the user for the name of a file to check, for example 1984.txt, and the program will read in words from that file one at a time and check if each word is among the 1000 most common words. If so, you will count it. The program will display the total number of words in the file, the percentage of words that are in the 1000 most common, and the percentage of words not in the 1000 most common.

The program must have a vertical bar chart showing the percentage of words in versus the percentage of words not in the 1000 most common.


I think I have the common words in an array correctly, i'm just stuck on how to count the common words versus the non common words if that makes sense?

Tutor Answer

(Top Tutor) Studypool Tutor
School: New York University
Studypool has helped 1,244,100 students
flag Report DMCA
Similar Questions
Hot Questions
Related Tags

Brown University

1271 Tutors

California Institute of Technology

2131 Tutors

Carnegie Mellon University

982 Tutors

Columbia University

1256 Tutors

Dartmouth University

2113 Tutors

Emory University

2279 Tutors

Harvard University

599 Tutors

Massachusetts Institute of Technology

2319 Tutors

New York University

1645 Tutors

Notre Dam University

1911 Tutors

Oklahoma University

2122 Tutors

Pennsylvania State University

932 Tutors

Princeton University

1211 Tutors

Stanford University

983 Tutors

University of California

1282 Tutors

Oxford University

123 Tutors

Yale University

2325 Tutors