Friends, I wish to consult about this big arithmetic program.
This program basically is calculating big numbers. It work great from command prompt, for instance: java bigal 999999999999999 99 + 5.
Is this program works without supplying command line arguments?
If possible then please guide me how to get it to work...really appreciate any help. many thanks.....
an excerpt from the Main method ....
This program basically is calculating big numbers. It work great from command prompt, for instance: java bigal 999999999999999 99 + 5.
Is this program works without supplying command line arguments?
If possible then please guide me how to get it to work...really appreciate any help. many thanks.....
Code:
public static void main(String[] args)
{
jonelo.sugar.util.GeneralProgram.requiresMinimumJavaVersion("1.3.1");
try {
new Main(args);
} catch (BigAlException e)
{
System.err.println(e.getMessage());
System.exit(1);
}
}
Code:
public Main(String[] args) throws BigAlException
{
if (args.length < 1) {
printHelpShort();
return;
}
if (args.length < 2) {
if (args[0].equalsIgnoreCase("help") || args[0].equalsIgnoreCase("-h"))
printHelpLong("/help/bigal/help_en.txt"); else
if (args[0].equalsIgnoreCase("hilfe"))
printHelpLong("/help/bigal/help_de.txt"); else
printHelpShort();
return;
}
// operation valid?
int opcode = receiveOperation(args[1]);
if (opcode==UNKNOWN) throw new BigAlException("invalid operation");
// general init
BigInteger b1=null, b2=null, b3=null;
BigDecimal d1=null, d2=null, d3=null;
String out="";
// default init values for fibonacci
int fibseed0=0;
int fibseed1=1;
// 2nd number required?
if (!isSingleOperation(opcode)) {
if (args.length < 3) {
throw new BigAlException("This operation requires a 2nd number!");
}
if (isDecimalOperation(opcode))
d2 = receiveDecNumber(args[2]); else
b2 = receiveNumber(args[2]);
}
if (isDecimalOperation(opcode))
d1 = receiveDecNumber(args[0]); else
b1 = receiveNumber(args[0]);
// remember the counter
long begin = System.currentTimeMillis();
switch (opcode) {
case ADD: out=toString(d1.add(d2));
break;
case SUB: out=toString(d1.subtract(d2));
break;
case MUL: out=toString(d1.multiply(d2));
break;
case DIV:
Comment