File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Certification Results and the fly likes HAHA Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Certification » Certification Results
Bookmark "HAHA" Watch "HAHA" New topic


kerwin john abrinica

Joined: Jan 15, 2012
Posts: 5
import java.lang.*;
import java.util.StringTokenizer;
import java.text.DecimalFormat;
import java.text.NumberFormat;

public class WordCount
public static void main (String [] args)throws IOException
FileReader fr = new FileReader("wordCount_input.txt");
FileWriter fw = new FileWriter("wordCount_output.txt");
BufferedReader lolo = new BufferedReader(fr);
String s = lolo.readLine();
int tokenCount;

Double nono;

StringTokenizer st = new StringTokenizer(s);
tokenCount = st.countTokens();

System.out.println("Number of tokens = " + tokenCount );


public static void s(String roro){
while (st.hasMoreTokens()){

StringTokenizer zt = new StringTokenizer(s);
int tokenCount1 = zt.countTokens()/zt.countTokens();
double tokenCount2 = zt.countTokens()/zt.countTokens();
NumberFormat formatter = new DecimalFormat("#0.00");
nono = tokenCount2 / tokenCount;

System.out.println( "\t\t" + tokenCount1 + "\t" + formatter.format(nono));
fw.write("\r\t\t" + tokenCount1 + "\t" + formatter.format(nono));

// fr.close();
// fw.close();



John Jai

Joined: May 31, 2011
Posts: 1776
Please UseAMeaningfulSubjectLine and UseCodeTags. Why have you posted in Certification Results forum with subject line "HAHA"
It is sorta covered in the JavaRanch Style Guide.
subject: HAHA
jQuery in Action, 3rd edition