Write a method called wordLengths that accepts a Scanner representing an input file as its argument. Your method should read from the given file, count the number of letters in each token in the file, and output a result diagram of how many words contain each number of letters. Use tabs before the asterisks so that they'll line up. If there are no words of a given length, omit that line from the output.
For example, if the file contains the following text:
Before sorting:
13 23 480 -18 75
hello how are you feeling today
After sorting:
-18 13 23 75 480
are feeling hello how today you
your method should produce the following output to the console:
2: 6 ******
3: 10 **********
5: 5 *****
6: 1 *
7: 2 **
8: 2 **
Write a method called append that accepts two integer arrays as parameters and returns a new array that contains the result of appending the second array's values at the end of the first array. For example, if arrays list1 and list2 store {2, 4, 6} and {1, 2, 3, 4, 5} respectively, the call of append(list1, list2) should return a new array containing {2, 4, 6, 1, 2, 3, 4, 5}. If the call instead had been append(list2, list1), the method would return an array containing {1, 2, 3, 4, 5, 2, 4, 6}.
Any help would be appreciated thanks!
For example, if the file contains the following text:
Before sorting:
13 23 480 -18 75
hello how are you feeling today
After sorting:
-18 13 23 75 480
are feeling hello how today you
your method should produce the following output to the console:
2: 6 ******
3: 10 **********
5: 5 *****
6: 1 *
7: 2 **
8: 2 **
Write a method called append that accepts two integer arrays as parameters and returns a new array that contains the result of appending the second array's values at the end of the first array. For example, if arrays list1 and list2 store {2, 4, 6} and {1, 2, 3, 4, 5} respectively, the call of append(list1, list2) should return a new array containing {2, 4, 6, 1, 2, 3, 4, 5}. If the call instead had been append(list2, list1), the method would return an array containing {1, 2, 3, 4, 5, 2, 4, 6}.
Any help would be appreciated thanks!
Last edited by peasant is a baws on 2014-04-27, 05:40; edited 1 time in total (Reason for editing : forgot to write something initially)