Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Hi, I need to write a word count program that does not produce any duplicates ir

ID: 3647218 • Letter: H

Question

Hi, I need to write a word count program that does not produce any duplicates irregardless of any specific punctuation. The code that I have is as follows.

import. java.util.*;
public class WordCount
{
public static void main(String[]args)
{
final int Lines=6;
Scanner in=new Scanner (System.in)
String paragraph = "";
System.out.println( "Please input"+ Lines + "lines of text.");
for (int i=0; i < Lines; i+=1)
{
paragraph=paragraph+""+in.nextLine()
}
System.out.println(paragraph);
System.out.println(paragraph.length());

String word=""
int WordCount=0
for (int i=0; i<paragraph.length()-1; i+=1)
{
if (paragraph.charAt(i) !==' ')
{
word= ;
if(paragraph.charAt(i+1)==' ')
{
System.out.println(word);
wordCount +=1
word="";
}
}
}
}
}

Please write out the complete code.

Explanation / Answer

Mayy be this change in code is helpful for you import. java.util.*; public class WordCount { public static void main(String[]args) { final int Lines=6; Scanner in=new Scanner (System.in) String paragraph = ""; System.out.println( "Please input"+ Lines + "lines of text."); for (int i=0; i
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote