-
Notifications
You must be signed in to change notification settings - Fork 0
Week5 Tasks added #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it should print the values inside the file not in console
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.