Here's my Calc Program, free to use, copy, edit, view, etc.

import java.util.*;
import java.io.*;
import java.lang.*;
import java.applet.*;
import java.sql.*;
import javax.sql.*;
import java.net.*;
import java.awt.*;
import java.math.*;
import java.*;
import javax.*;
class calc
{
    public static void main()
    {
        Scanner in = new Scanner(System.in);
        int s1=0,s2=0,x=0,y=0,l=0,h=0,c=0,rem,res,n=0,s=0,r,add,subtract,multiply,divide,remainder,choice=0;
        int square1,square2,cube1,cube2,armstrongnumber1,armstrongnumber2,perfectnumber1,perfectnumber2;
        String a,b,a1,b1;
        int num1=0,num2=0;
        int n1=0;
        int n2=0;
        double p=0,result=0,logar1,logar2,sqroot1,sqroot2,absval1,absval2;
        {
            System.out.println("");
            System.out.println("    Multi - Function Calculator ");
            System.out.println("       Rjt Soft ");
            System.out.println("");
        }
        {
            System.out.print("    Enter the First number  : ");
            a=in.nextLine();
            a1=a;
            System.out.println("");
            System.out.print("    Enter the Second number : ");
            b=in.nextLine();
            b1=b;
            System.out.println("");
            boolean isIntegerOfA;
            {
                try
                {
                    Integer.parseInt(a);
                    isIntegerOfA = true;
                }
                catch( Exception e )
                {
                    isIntegerOfA = false;
                }
            }
            boolean isIntegerOfB;
            {
                try
                {
                    Integer.parseInt(b);
                    isIntegerOfB = true;
                }
                catch( Exception f )
                {
                    isIntegerOfB = false;
                }
            }
            if (isIntegerOfA==true && isIntegerOfB==true)
            {
                num1=Math.max(Integer.parseInt(a),Integer.parseInt(b));
                num2=Math.min(Integer.parseInt(a),Integer.parseInt(b));
            }
            if (isIntegerOfA==true && isIntegerOfB==false)
            {
                System.out.println("    Invalid Entry of the Second Number ( "+b1+" ). ");
                retrial2.tryout();
            }
            if (isIntegerOfA==false && isIntegerOfB==true)
            {
                System.out.println("    Invalid Entry of the First Number ( "+a1+" ). ");
                retrial2.tryout();
            }
            if (isIntegerOfA==false && isIntegerOfB==false)
            {
                System.out.println("    Invalid Entry of both the First Number ( "+a1+" ) and the Second Number ( "+b1+" ). ");
                retrial2.tryout();
            }
        }
        {
            System.out.println("    Which Operation would you like to do ? ");
            System.out.println("");
            System.out.println("    1.  Calculate the Sum of the Numbers                                                  ");
            System.out.println("    2.  Calculate the Difference between the Numbers                                      ");
            System.out.println("    3.  Calculate the Product of the Numbers                                              ");
            System.out.println("    4.  Calculate the Quotient and the Remainder of the Numbers                           ");
            System.out.println("    5.  Find Out the Natural Logarithm of the Numbers                                     ");
            System.out.println("    6.  Find Out the Absolute Value of the Numbers                                        ");
            System.out.println("    7.  Calculate the Squares of the Numbers                                              ");
            System.out.println("    8.  Calculate the Cubes of the Numbers                                                ");
            System.out.println("    9.  Find Out the Square root of the Numbers                                           ");
            System.out.println("    10. Check whether the Numbers are Armstrong Numbers                                   ");
            System.out.println("    11. Check whether the Numbers are Perfect Numbers                                     ");
            System.out.println("    12. Check whether the Numbers are Palindrome Numbers                                  ");
            System.out.println("    13. Check whether the Numbers are Automorphic Numbers                                 ");
            System.out.println("    14. Check whether the Numbers are Prime Numbers or Composite Numbers                  ");
            System.out.println("    15. Find Out the Highest Common Factor of the Numbers                                 ");
            System.out.println("    16. Find Out the Least Common Multiple of the Numbers                                 ");
            System.out.println("    17. Check whether the Numbers are Amicable Numbers                                    ");
            System.out.println("");
        }
        {
            System.out.print("    Enter your choice : ");
            try
            {
                choice=Integer.parseInt(in.nextLine());
            }
            catch( Exception g )
            {
                System.out.println("");
                System.out.println("    Incorrect input. Please retry. ");
                retrial2.tryout();
            }
            System.out.println("");
        }
        switch(choice)
        {
            case 1:
            {
                add=num1+num2;
                System.out.println("    The Sum of the Numbers "+num1+" and "+num2+" is : "+add);
            }
            break;
            case 2:
            {
                subtract=num1-num2;
                System.out.println("    The Difference of the Numbers "+num1+" and "+num2+" is : "+subtract);
            }
            break;
            case 3:
            {
                multiply=num1*num2;
                System.out.println("    The Product of the Numbers "+num1+" and "+num2+" is : "+multiply);
            }
            break;
            case 4:
            {
                divide=num1/num2;
                remainder=num1%num2;
                System.out.println("    The Quotient obtained by the Division of the Numbers "+num1+" and "+num2+" is : "+divide);
                System.out.println("");
                System.out.println("    The Remainder obtained by the Division of the Numbers "+num1+" and "+num2+" is : "+remainder);
            }
            break;
            case 5:
            {
                logar1=Math.log(num1);
                logar2=Math.log(num2);
                System.out.println("    The Natural Logarithm of the Number "+num1+" is "+logar1);
                System.out.println("");
                System.out.println("    The Natural Logarithm of the Number "+num2+" is "+logar2);
            }
            break;
            case 6:
            {
                absval1=Math.abs(num1);
                absval2=Math.abs(num2);
                System.out.println("    The Absolute Value of the Number "+num1+" is "+absval1);
                System.out.println("");
                System.out.println("    The Absolute Value of the Number "+num2+" is "+absval2);
            }
            break;
            case 7:
            {
                square1=(num1)*(num1);
                square2=(num2)*(num2);
                System.out.println("    The Square of the Number "+num1+" is "+square1);
                System.out.println("");
                System.out.println("    The Square of the Number "+num2+" is "+square2);
            }
            break;
            case 8:
            {
                cube1=(num1)*(num1)*(num1);
                cube2=(num2)*(num2)*(num2);
                System.out.println("    The Cube of the Number "+num1+" is "+cube1);
                System.out.println("");
                System.out.println("    The Cube of the Number "+num2+" is "+cube2);
            }
            break;
            case 9:
            {
                sqroot1=Math.sqrt(num1);
                sqroot2=Math.sqrt(num2);
                System.out.println("    The Square Root of the Number "+num1+" is "+sqroot1);
                System.out.println("");
                System.out.println("    The Square Root of the Number "+num2+" is "+sqroot2);
            }
            break;
            case 10:
            {
                s=0;
                n1=num1;
                for (int i=1;num1>0;i++)
                {
                    r=num1%10;
                    s+=r*r*r;
                    num1/=10;
                }
                if (n1==s)
                {
                    System.out.println("    The Number "+n1+" is an Armstrong number. ");
                }
                if (n1!=s)
                {
                    System.out.println("    The Number "+n1+" is not an Armstrong number. ");
                }
                System.out.println("");
                s=0;
                n2=num2;
                for (int i=1;num2>0;i++)
                {
                    r=num2%10;
                    s+=r*r*r;
                    num2/=10;
                }
                if (n2==s)
                {
                    System.out.println("    The Number "+n2+" is an Armstrong number. ");
                }
                if (n2!=s)
                {
                    System.out.println("    The Number "+n2+" is not an Armstrong number. ");
                }
            }
            break;
            case 11:
            {
                s=0;
                int number1;
                number1=num1;
                for (int i=1;i<number1;i++)
                {
                    if (number1%i==0)
                    {
                        s+=i;
                    }
                }
                if (s==number1)
                {
                    System.out.println("    The Number "+num1+" is a Perfect Number. ");
                }
                if (s!=number1)
                {
                    System.out.println("    The Number "+num1+" is not a Perfect Number. ");
                }
                System.out.println("");
                int number2;
                number2=num2;
                s=0;
                for (int i=1;i<number2;i++)
                {
                    if (number2%i==0)
                    {
                        s+=i;
                    }
                }
                if (s==number2)
                {
                    System.out.println("    The Number "+num2+" is a Perfect Number. ");
                }
                if (s!=number2)
                {
                    System.out.println("    The Number "+num2+" is not a Perfect Number. ");
                }
            }
            break;
            case 12:
            {
                rem=0;
                res=0;
                n=num1;
                while(num1>0)
                {
                    rem=num1%10;
                    res=res*10+rem;
                    num1/=10;
                }
                if(n==res)
                {
                    System.out.println("    The Number "+n+" is a Palindrome number. ");
                }
                else
                {
                    System.out.println("    The Number "+n+" is not a Palindrome number. ");
                }
                System.out.println("");
                rem=0;
                res=0;
                n=num2;
                while(num2>0)
                {
                    rem=num2%10;
                    res=res*10+rem;
                    num2/=10;
                }
                if(n==res)
                {
                    System.out.println("    The Number "+n+" is a Palindrome number. ");
                }
                else
                {
                    System.out.println("    The Number "+n+" is not a Palindrome number. ");
                }
            }
            break;
            case 13:
            {
                p=num1;
                n=num1;
                s=(num1)*(num1);
                while (n>0)
                {
                    if(n%10!=s%10)
                    {
                        result=1;
                        break;
                    }
                    s=s/10;
                    n=n/10;
                }
                if (result==0)
                {
                    System.out.println("    The Number "+p+" is an Automorphic Number. ");
                }
                if (result!=0)
                {
                    System.out.println("    The Number "+p+" is not an Automorphic Number. ");
                }
                System.out.println("");
                p=num2;
                n=num2;
                s=(num2)*(num2);
                while (n>0)
                {
                    if(n%10!=s%10)
                    {
                        result=1;
                        break;
                    }
                    s=s/10;
                    n=n/10;
                }
                if (result==0)
                {
                    System.out.println("    The Number "+p+" is an Automorphic Number. ");
                }
                if (result!=0)
                {
                    System.out.println("    The Number "+p+" is not an Automorphic Number. ");
                }
            }
            break;
            case 14:
            {
                n=num1;
                for(int i=1;i<=n;i++)
                {
                    if(n%i==0)
                    {
                        c++;
                    }
                }
                if(c==2)
                {
                    System.out.println("    The Number "+num1+" is a Prime Number. ");
                }
                if(c!=2)
                {
                    System.out.println("    The Number "+num1+" is a Composite Number. ");
                }
                System.out.println("");
                n=num2;
                for(int i=1;i<=n;i++)
                {
                    if(n%i==0)
                    {
                        c++;
                    }
                }
                if(c==2)
                {
                    System.out.println("    The Number "+num2+" is a Prime Number. ");
                }
                if(c!=2)
                {
                    System.out.println("    The Number "+num2+" is a Composite Number. ");
                }
            }
            break;
            case 15:
            {
                x=num1;
                y=num2;
                p=x*y;
                for (int i=1;i<=p;i++)
                {
                    if (x%i==0 && y%i==0)
                    {
                        h=i;
                    }
                }
                System.out.println("    The Highest Common Factor of the Numbers "+num1+" and "+num2+" is "+h+" .");
            }
            break;
            case 16:
            {
                x=num1;
                y=num2;
                x=Math.abs(x);
                y=Math.abs(y);
                for(n=1;n>=0;n++)
                {
                    if(n%x==0 && n%y==0)
                    {
                        l=n;
                        System.out.println("    The Least Common Multiple of the Numbers "+num1+" and "+num2+" is "+l+" .");
                        break;
                    }
                }
            }
            break;
            case 17:
            {
                x=num1;
                y=num2;
                for(int i=1;i<=x;i++)
                {
                    if(x%i==0)
                    {
                        s1+=i;
                    }
                }
                for(int i=1;i<=y;i++)
                {
                    if(y%i==0)
                    {
                        s2+=i;
                    }
                }
                if(s1==s2)
                {
                    System.out.println("    The Numbers "+x+" and "+y+" are Amicable Numbers.");
                }
                if(s1!=s2)
                {
                    System.out.println("    The Numbers "+x+" and "+y+" are not Amicable Numbers.");
                }
            }
            break;
            default:
            {
                System.out.println("    Invalid Entry ");
            }
            break;
        }
        retrial2.tryout();// opening class retrial2 method tryout
    }
}
class retrial2// declaring retrial as the class name
{
    public static void tryout()// another method name (  tryout()  )is used
    {
        String retry="";// declaring variable retry as a string
        Scanner in3 = new Scanner(System.in);// defining the variable "in3" as a scanner class
        System.out.println("");
        System.out.print("    Do you want to try again ? ");// asking the user for input
        retry=in3.nextLine();// using a scanner class for input
        switch (retry)// taking the string retry as the variable used to choose the case
        {
            case "Yes":// if input is "Yes"
            System.out.print('\u000C'); // printing a formfeed character ( BlueJ only ) to clear the screen
            calc.main();// going to the main method of the calc class
            break;
            case "Y":// if input is "Y"
            System.out.print('\u000C'); // printing a formfeed character ( BlueJ only ) to clear the screen
            calc.main();// going to the main method of the calc class
            break;
            case "yes":// if input is "yes"
            System.out.print('\u000C'); // printing a formfeed character ( BlueJ only ) to clear the screen
            calc.main();// going to the main method of the calc class
            break;
            case "YES":// if input is "YES"
            System.out.print('\u000C'); // printing a formfeed character ( BlueJ only ) to clear the screen
            calc.main();// going to the main method of the calc class
            break;
            case "y":// if input is "Y"
            System.out.print('\u000C'); // printing a formfeed character ( BlueJ only ) to clear the screen
            calc.main();// going to the main method of the calc class
            break;
            case "yep":// if input is "y"
            System.out.print('\u000C'); // printing a formfeed character ( BlueJ only ) to clear the screen
            calc.main();// going to the main method of the calc class
            break;
            case "Yep":// if input is "Yep"
            System.out.print('\u000C'); // printing a formfeed character ( BlueJ only ) to clear the screen
            calc.main();// going to the main method of the calc class
            break;
            case "YEP":// if input is "YEP"
            System.out.print('\u000C'); // printing a formfeed character ( BlueJ only ) to clear the screen
            calc.main();// going to the main method of the calc class
            break;
            case "No":// if input is "No"
            System.exit(0);// exiting the program
            break;
            case "N":// if input is "N"
            System.exit(0);// exiting the program
            break;
            case "no":// if input is "no"
            System.exit(0);// exiting the program
            break;
            case "NO":// if input is "NO"
            System.exit(0);// exiting the program
            break;
            case "n":// if input is "n"
            System.exit(0);// exiting the program
            break;
            case "nope":// if input is "nope"
            System.exit(0);// exiting the program
            break;
            case "Nope":// if input is "Nope"
            System.exit(0);// exiting the program
            break;
            case "NOPE":// if input is "NOPE"
            System.exit(0);// exiting the program
            break;
            default:// if input doesnt correspond with any of the above cases
            System.out.println("");
            System.out.println("    Invalid Entry ");// Printing invalid entry
            retrial2.tryout();// retrying this set of cases with a new input
            break;
        }
    }
}

       

Hope it helps !