Ejemplo n.º 1
0
 /**
  * Read a string from the command line
  *
  * @return a string
  */
 public static String readWord() {
   scanTo(tokenizer.TT_WORD);
   if (tokenizer.sval != null) {
     if (outFile != null) outFile.println("" + tokenizer.sval);
     return (tokenizer.sval);
   } else {
     if (outFile != null) outFile.println("" + ((char) tokenizer.ttype));
     return ("" + ((char) tokenizer.ttype));
   }
 }
Ejemplo n.º 2
0
 /**
  * Read a integer from the command line
  *
  * @return a integer
  */
 public static int readInt() {
   scanTo(tokenizer.TT_NUMBER);
   if (outFile != null) outFile.println("" + (int) tokenizer.nval);
   return ((int) tokenizer.nval); // use Math.trunc??
 }
Ejemplo n.º 3
0
 /**
  * Read a double from the command line
  *
  * @return a double
  */
 public static double readDouble() {
   scanTo(tokenizer.TT_NUMBER);
   if (outFile != null) outFile.println("" + tokenizer.nval);
   return (tokenizer.nval);
 }