Tuesday, 15 March 2011

Can someone explain to me what this Array Java program wants me to do? -



Can someone explain to me what this Array Java program wants me to do? -

i stuck on 1 problem on arrays. haven't started programme yet because don't understand wants me do! here problem:

write method called wordlengths accepts string representing file name argument. method should open given file, count number of letters in each token in file, , output result diagram of how many words contain each number of letters. example, next text:

before sorting:

12 23 480 -18 75

hello how feeling today

after sorting:

-18 13 23 75 480

are feeling hello how today you

your method should produce next output console:

1: 0 2: 6 [there should 6 * printed here] 3: 10 [there should 10 * printed here] 4: 0 5: 5 [there should 5 * printed here] 6: 1 [there should 1 * printed here] 7: 2 [there should 2 * printed here] 8: 2 [there should 2 * printed here]

so stackoverflow rather limited, wasn't able show total style of output, in summary, "before sorting:" part followed 2 sentences 1 group, "after sorting:" , 2 sentences below group. "before" , "after" sorting separated 1 space.

i don't how output achieved, that's problem. have feeling 1-8 represents line numbers, 0, 6, 10, etc. represent? because when counted word lengths, exceeded 6 or 10... it'd great help if explain me programme wants me do.

thanks in advance!

1 - 8 length of word (or number, or token); -18 has length 3, , "sorting:" 8.

0, 6, 10... number of occurrences words have length 1, 2, 3...

btw, not question fitting here hope help.

java arrays

No comments:

Post a Comment