Writing a simple calculator in Java

Hello Guys.. This is my First Tutorial in PlazaNG on Java programming. 

images 5 - Writing a simple calculator in Java

If You Want To Start Java Programming Then At First You Need To Download Netbeans Or Eclipse IDE

Go To

Download Netbeans IDE

From Here Download Netbeans.  Download Java SE for Standard Edition Or If You Want To Work With All Platforms  Download All

After Download Install Netbeans IDE

Now Go To File>>New Project>>Java>>Java Application

Now Give Your Project Name. I am Showing You a Simple Calculator. This is Very Beginning And It will Work in Java Console. It is Not A Graphical Software so it has no UI yet. Later I Will Show You steps in making Java Desktop And Mobile Software.

So Project Name it as Calculator. Click Next. A White Window Will be Opned. Remove All Code And Paste This Code

import java.util.Scanner;
public class Calculator {
    public static void main(String[] args) {
        Scanner input=new Scanner(;
        double a,b;
        System.out.println(“Enter 1st Number=”);
        System.out.println(“Enter 2nd Number=”);
        System.out.println(“Enter + For Add=”);
                System.out.println(“Enter – For subtract=”);
                System.out.println(“Enter * For multiplication=”);
                System.out.println(“Enter / For divition=”);
        char c;
        System.out.println(“Enter Character=”);;
        case ‘+':
            System.out.println(“Addition Is=”+(a+b));
        case ‘-‘:
            System.out.println(“Subtraction Is=”+(a-b));
        case ‘*':
            System.out.println(“Multiplication Is=”+(a*b));
        case ‘/':
            System.out.println(“Divition Is=”+(a/b));
                System.out.println(“Invalid Input”);

Now  Go to Run And Click Run File. In Below Output Console Your Program Will be Started To Run. Give Two Number. Then Give Operator And You Will Show Your Calculated Output.

Get PlazaNG from the Amazon Appstore.
Show More

Related Articles

Leave a Reply

Leave a Reply

Your email address will not be published.

error: Content is protected!! Contact Head Admin For More Information