Flesch Index program Java -


i writing program calculates flesch index of passage in java. few things: can't figure out how make can input many words while hitting enter , not calculate (something d tells no more input coming). having trouble boolean expression. have tried & , && , still doesn't work. keep getting message says, "syntax error on token "&&", throw expected"

import java.util.scanner;  public class flesch {   public static void main (string [] args)   {     scanner input = new scanner (system.in);      // declare variables syllables , words     int totalwords = 0;     int totalsyllables = 0;      // prompt user passage of text     system.out.println ("please enter text:");     string passage = input.nextline();      // words     (int = 0; < passage.length(); i++)     {       if (passage.charat(i) == ' ') {         totalwords++;       }       else if (passage.charat(i) == '.') {         totalwords++;       }       else if (passage.charat(i) == ':') {         totalwords++;       }       else if (passage.charat(i) == ';') {         totalwords++;       }       else if (passage.charat(i) == '?') {         totalwords++;       }       else if (passage.charat(i) == '!') {         totalwords++;       }       else {         totalwords = totalwords;       }     }       system.out.println ("there " + totalwords + " words.");      char syllablelist [] = {'a', 'e', 'i', 'o', 'u', 'y'};      // syllables     (int k = 0; k < syllablelist.length; k++)     {       (int = 0; < passage.length(); i++)       {         if (passage.charat(i) == syllablelist[k]) && (passage.charat(i) == syllablelist[k]); {           totalsyllables = totalsyllables;         }         if (passage.charat(i) == syllablelist[1] + ' ') {           totalsyllables = totalsyllables;         }         if (passage.charat(i) == syllablelist[k]) {           totalsyllables++;         } else {           totalsyllables = totalsyllables;         }       }     }         system.out.println ("there " + totalsyllables + " syllables.");   } } 

i know have type in calculations, right trying count number of words , syllables. once works, add in calculation find flesch index. guys. reason error on line says

if (passage.charat(i) == syllablelist[k]) && (passage.charat(i) == syllablelist[k]); 

and have no clue why getting or how fix it.


Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -