Devam Ediyor

488393 java word analyze

i need to simplify the letter count and add scaling to the word bar char and also the frequency and length need to go up to any number so if there is 50 it would go to fifty and if there was fourty it would only go to forty i have the array set to 12 but it needs to read a file and then produce the amount of frequency and length in that particular file

import java.io.*;

import java.util.*;

class WordCount

{

public static void main(String[] args) throws IOException

{

FileReader file = new FileReader("[url removed, login to view]");

BufferedReader MyFile = new BufferedReader(file);

StringTokenizer TokenizeMe= new StringTokenizer("");

int NumberOfTokens = 0;

int NumberOfWords = 0;

char barchart = '#';

char[] letters = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J','K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'};

int frequency [] = new int [12];

// frequency [] stores number of words of length

int a;

String line="";

while((line=[url removed, login to view]())!=null)

{

[url removed, login to view]("Processing line="+ line );

TokenizeMe = new StringTokenizer(line);

NumberOfTokens = [url removed, login to view]();

for (int WordsInLine=1; WordsInLine<=NumberOfTokens; WordsInLine++)

{

String word=[url removed, login to view]();

int len=[url removed, login to view]();

frequency[len]++;

[url removed, login to view]("Processing word="+ word + " " +len);

}

NumberOfWords += NumberOfTokens;

}

[url removed, login to view]("\nThere are " + NumberOfWords + " words in the text");

[url removed, login to view]();

for(a=1; a< [url removed, login to view];a++)

{

[url removed, login to view] ("length: " +a+ ", Frequency: " + frequency[r]);

}

for(int b=1; b<[url removed, login to view]; b++)

{

[url removed, login to view](b + " : ");

for(int c=0; c<frequency[b]; c++)

{

[url removed, login to view](barchart);

}

[url removed, login to view]();

}

[url removed, login to view]();

FileReader fr = new FileReader("[url removed, login to view]");

BufferedReader buffer = new BufferedReader(fr);

String inString;

StringBuffer completeText = new StringBuffer();

while ((inString = [url removed, login to view]()) !=null)

{

String upperCase = [url removed, login to view]();

[url removed, login to view](upperCase);

[url removed, login to view](upperCase);

}

char ch;

int count=0;

for (int d = 0; d < 26; d++)

{

count = 0;

for (int e = 0; e<[url removed, login to view](); e++)

{

ch = [url removed, login to view](e) ;

if( ch== letters[d])

{

count++;

}

}

[url removed, login to view](" " + letters[d]);

[url removed, login to view](" " + count);

[url removed, login to view]();

}

}

}

Beceriler: Her şey Kabul, C Programlama, Java, Javascript

Daha fazlasını görün: string j, static programming, public programming, print println java, int v, import io, programming static, programming char, char programming, word p, r j, new fr, letter g, len, io, word programming, word print, java bar, processing java, print word, count words frequency, append line file, file system java, java import file, java count

İşveren Hakkında:
( 1 değerlendirme )

Proje NO: #2234304

Seçilen:

eperfections

I can do this easy assignment. I will add lot of comments in the code so that you can understand it.

0 gün içinde 19$ USD
(508 Değerlendirme)
7.5