Question:
need help with JAVA...i need to write a program that reports the frequency of a certain word in a text file.?
diego_bravo13
2011-11-27 17:41:49 UTC
For this assignment you are to write a program that handles text files. The assignment requires three classes (plus library classes); we've given you two - FreqStudy, the driver, and another class, WordCount.

/JavaCS1/src/freqstudy/FreqStudy.java
/JavaCS1/src/freqstudy/WordCount.java

Your job is to write WordFreq, the heart of the application. It must extend Echo:

Echo.java


http://twiki-edlab.cs.umass.edu/bin/view/CS121Fall2011/PrSeven
(this shows the problem) i am having extreme difficulty, please help.


import java.util.*;
import java.io.*;

public class FreqStudy{
public static void main(String[] args) throws IOException
{
Scanner scan = new Scanner(System.in);
System.out.println("enter file name");
String fileName = scan.next();
Scanner scan2 = new Scanner(System.in);
System.out.println("enter words to search for");
System.out.println("enter lower case, separated by spaces");
String wordString = scan2.nextLine();
WordFreq f = new WordFreq(fileName,wordString);
f.readLines();
f.reportFrequencies();
}
}

public class WordCount{

private String word;
private int count;

public WordCount(String w){
word = w;
count = 0;
}

public String getWord(){
return word;}

public int getCount(){
return count;}

public void incCount(){count++;}

public String toString() {
return(word + " --- " + count);
}

public boolean equals(Object other){
WordCount i = (WordCount)other;
return (this.word.equals(i.word));
}
}


import java.util.Scanner;
import java.io.*;

public class Echo{
String fileName; // external file name
Scanner scan; // Scanner object for reading from external file

public Echo(String f) throws IOException
{
fileName = f;
scan = new Scanner(new FileReader(fileName));
}

public void readLines(){ // reads lines, hands each to processLine
while(scan.hasNext()){
processLine(scan.nextLine());
}
scan.close();
}

public void processLine(String line){ // does the real processing work
System.out.println(line);
}
}
Four answers:
anonymous
2011-11-27 17:43:23 UTC
Read the answer here:

http://stackoverflow.com/questions/2635082/java-counting-of-occurrences-of-a-word-in-a-string
anonymous
2015-01-25 06:01:40 UTC
Binary options let users trade in currency pairs and stocks for various predetermined time-periods, minimal of which is 30 seconds. Executing trades is straightforward. The system uses user-friendly interfaces, which even an 8 years old kid, can operate without having to read any instructions. But winning trades is Not easy.

Binary trading is advertised as the only genuine system that lets users earn preposterous amounts of money in ridiculously short period of time. Advertisers try to implicate as if you can make $350 every 60 seconds; if it was true then binary trading would truly be an astonishing business.

However, does it make any sense? Can every trader make tons of money in binary trading? Who is actually paying all the money or the profit to traders?

The first challenge is finding a trustworthy binary broker; secondly, you need to find a binary trading strategy, which you can use to make profits consistently. Without an effective trading strategy, there is no way you can make money in this business.

Learning a profitable trading strategy is possible, You should watch this presentation video https://tr.im/d0306

It's probably the best way to learn how to win with binary option
?
2014-10-04 14:52:55 UTC
Binary trading is notoriously risky but if you follow a special method I've learned you can earn good money at almost no risk. This is the site I use: ( http://forexsignal.kyma.info ) I definitely recommend subscribing to this site in particular. I was a bit weary of binary trading from all the bad hype they receive but this site is pretty legit. This course explain everything you need to start a very profitable trading activity. Remember never invest 100% of your capital into any one security and never have 100% of your capital invested and a good understanding of the rules
anonymous
2014-09-25 07:29:39 UTC
You can't succed in binary trading without a strategy, a good method to follow and some kind of software support. They program I use is called "Autobinary signals". It helps finding loopholes for guaranteed returns. It's very easy to use and I'm earning good money. You find all the details on this site: http://tradingsignal.toptips.org


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...