Java Reference
In-Depth Information
else if (command.equals("exit"))
return false ;
else
System.out.println("Error! Not a valid command");
}
catch (IOException ioe) { ioe.printStackTrace(); }
return true ;
}
void printHelp() {
System.out.println();
System.out.println
("Insert one of the following commands:");
System.out.println
(" op <number> (store an operand)");
System.out.println
(" !
(sum the last two operands)");
System.out.println
(" - (subtract the last two operands)");
System.out.println
(" * (multiply the last two operands)");
System.out.println
(" / (divide the last two operands)");
System.out.println
(" dec (switch to base 10)");
System.out.println
(" bin (switch to binary base)");
System.out.println
(" hex (switch to hexadecimal base)");
System.out.println
(" fixed (switch to fixed point format)");
System.out.println
(" float (switch to floating point format)");
System.out.println
(" rat (switch to rational format)");
System.out.println
(" del (remove last operand)");
System.out.println
(" help (print this command list)");
System.out.println
(" exit (terminate execution)");
System.out.println();
}
public static void main(String[] args) {
Command command # new Command();
while (command.nextCommand());
}
}
}
Search WWH ::




Custom Search