• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HAHA

 
kerwin john abrinica
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
import java.lang.*;
import java.io.*;
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()){

System.out.println();
while(st.hasMoreElements()){
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));
break;
}

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



}

}

}
 
John Jai
Rancher
Posts: 1776
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please UseAMeaningfulSubjectLine and UseCodeTags. Why have you posted in Certification Results forum with subject line "HAHA"
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic