• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

HAHA

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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();



}

}

}
 
Rancher
Posts: 1776
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please UseAMeaningfulSubjectLine and UseCodeTags. Why have you posted in Certification Results forum with subject line "HAHA"
reply
    Bookmark Topic Watch Topic
  • New Topic