All pastes #2075799 Raw Edit

Something

public text v1 · immutable
#2075799 ·published 2011-06-06 22:43 UTC
rendered paste body
import static pt.ua.prog.WIO.*;

class ex2Teste
{
  static int MAX_ELEMS = 20;

  public static void main(String [] args) 
  {
    String s;
    s= readLine("Introduza a frase: ");
    boolean result;
    result = verificaFrase(s);
    if(result)
       println("Frase ok");
    else
       println("Frase not ok");
  }



  static boolean verificaFrase(String s)
  {
    for(int i=0; i<s.length(); i++)
    {
       char c = s.charAt(i);
       if(!(c==',' || c=='!' || c==' ' || c=='?' || (c>='a' && c<='z') || (c>='A' && c<='Z')))
          return false;
    } 
    return true;
  }
}