/** * 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)); } }
/** * 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?? }
/** * 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); }