Conversation
Task 2-Word Count/src/Main.java
Outdated
|
|
||
| Scanner scanner = new Scanner(file); | ||
| int count = 0; | ||
| while (scanner.hasNext()) { |
There was a problem hiding this comment.
the hasnext depend on white spaces to split the text to tokens so it will count also -- and , as words so try to modify you code to not count them.
aslo you could will be in while loop for infinty becuase it always check for the first word for ever so but scanner.next() in whilc loop to solve the issue
Task 2-Word Count/src/Main.java
Outdated
| while (scanner.hasNext()) { | ||
| count++; | ||
| } | ||
| System.out.println("The Lincoln file contains " + count + " words."); |
There was a problem hiding this comment.
you should print the numer inside the file not in console
Task 3/src/Main.java
Outdated
| System.out.println("The summation of words: " + file.getSum(path)); | ||
| System.out.println("The average of words: " + file.getAverage(path)); |
There was a problem hiding this comment.
it should print the values inside the file not in console
There was a problem hiding this comment.
As task description the readFromWebToFile method should take url and return a file not a string.
the methods getSum and getAverage should take a file as input not string and return an integer.
No description provided.