java - Simple Command Line calculator -


i have written code command-line calculator in java can't understand errors not allowing compile

public class calculator{ public static void main(string[] args){  int numone = args[0]; int numtwo = args[1];  add(numone, numtwo) {     result = numone + numtwo;     system.out.println("{numone} + {numtwo} = {result}"); }  subtract(numone, numtwo) {     result = numone - numtwo;     system.out.println("{numone} - {numtwo} = {result}"); }  multiply(numone, numtwo) {     result = numone * numtwo;     system.out.println("{numone} * {numtwo} = {result}"); }  divide(numone, numtwo) {     result = numone / numtwo;     system.out.println("{numone} / {numtwo} = {result}"); } } } 

the translation java of code is:

public class calculator {    public static void add(int numone, int numtwo) {     int result = numone + numtwo;     system.out.println(numone + " + " + numtwo + " = " + result);   }    public static void subtract(int numone, int numtwo) {     int result = numone - numtwo;     system.out.println(numone + " - " + numtwo + " = " + result);   }    public static void multiply(int numone, int numtwo) {     int result = numone * numtwo;     system.out.println(numone + " * " + numtwo + " = " + result);   }    public static void divide(int numone, int numtwo) {     int result = numone / numtwo;     system.out.println(numone + " / " + numtwo + " = " + result);   }    public static void main(string[] args) {     int numone = integer.parseint(args[0]);     int numtwo = integer.parseint(args[1]);     add(numone, numtwo);     subtract(numone, numtwo);     multiply(numone, numtwo);     divide(numone, numtwo);   } } 

Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -