Calculator

Calculator

need a simple java program to degin a CALCULATOR without using ADVANCED JAVA....

View Answers

October 17, 2011 at 11:14 AM


June 5, 2012 at 8:59 PM

import java.util.Scanner;

public class Cal {

public static void main(String[] args) {
    int a,b,i;
    System.out.println("Enter The Value Of A and B");
    Scanner sc=new Scanner(System.in);
    a=sc.nextInt();
    b=sc.nextInt();
    System.out.println("Enter 1 for Add");
    System.out.println("Enter 2 for Sub");
    System.out.println("Enter 3 for Multi");
    System.out.println("Enter 4 for Divide");
    i=sc.nextInt();

    switch (i)
    {
            case 1:
                System.out.println("Add is "+(a+b));  
                break;
            case 2:
                System.out.println("Sub is "+(a-b));
                break;
            case 3:
                System.out.println("Multi is "+(a*b));
                break;
            case 4:
                System.out.println("Divide is "+(a/b));
                break;
            default:
                System.out.println("Please Enter Correct Value");
                break;


}
}

}









Related Tutorials/Questions & Answers:
Calculator
Calculator  need a simple java program to degin a CALCULATOR without using ADVANCED JAVA....   Calculator in Java Swing
calculator midlet
calculator midlet  give me code calculator midlet in bluetooth application with j2me
Advertisements
simple calculator program in javascript
simple calculator program in javascript  strong textsimple calculator in javascript
Calculator class
Calculator class  I am a beginner in Eclipse. I have to do a program called calculator that adds numbers. This is my code so far: //Margaret //ICS... class Calculator extends JFrame implements ActionListener { JTextField text
Calculator
ModuleNotFoundError: No module named 'Calculator'
ModuleNotFoundError: No module named 'Calculator'  Hi, My Python... 'Calculator' How to remove the ModuleNotFoundError: No module named 'Calculator' error? Thanks   Hi, In your python environment you
thread program for calculator implementation
thread program for calculator implementation  Hi i'm prem i need calculator progrm in java that are implemented by Thread interface.....pls strong text
base calculator.. - Java Beginners
base calculator..  Help, i need some help about a base calculator.. i don't know how to start
calculator - Java Interview Questions
calculator  create calculator by java code  Hi Friend, Please visit the following link: http://www.roseindia.net/java/example/java/swing/calculator-in-swing.shtml Thanks
Program for Calculator - Swing AWT
Program for Calculator  write a program for calculator?  Hi Friend, Please visit the following link: http://www.roseindia.net/java/example/java/swing/calculator-in-swing.shtml Hope that it will be helpful
PHP Tax Calculator - PHP
PHP Tax Calculator  In my project i required a tax calculator that can calculate the property tax
calculator - Java Server Faces Questions
calculator  Some ideas for the project of calculator
simple calculator - Java Beginners
simple calculator  how can i create a simple calculator using java codes?  Hi Friend, Please visit the following link: http://www.roseindia.net/java/example/java/swing/calculator-in-swing.shtml Thanks
Calculator - JSP-Servlet
Calculator  Dear Deepak Sir, Calculator program is avilable in Jsp... calculator program in jsp function checkValue(){ var msg...; } Simple calculator program in jsp /> >
How to write calculator in J2ME program?
How to write calculator in J2ME program?  How to write calculator in J2ME program
Scientific Calculator - Java Beginners
Scientific Calculator  Develop a scientific calculator using even-driven programming paradigm of Java.? Thanks in ADVANCE  Hi Friend, Please visit the following link: http://www.roseindia.net/tutorial/java
matrix calculator - Java Beginners
matrix calculator  hi..... can you help me in writing source code of matrix calculator in java... i know you are the best you can do it!!! show yourself
ModuleNotFoundError: No module named 'currency-calculator'
ModuleNotFoundError: No module named 'currency-calculator'  Hi, My... named 'currency-calculator' How to remove the ModuleNotFoundError: No module named 'currency-calculator' error? Thanks   Hi
ModuleNotFoundError: No module named 'Dewpoint-Calculator'
ModuleNotFoundError: No module named 'Dewpoint-Calculator'  Hi, My... named 'Dewpoint-Calculator' How to remove the ModuleNotFoundError: No module named 'Dewpoint-Calculator' error? Thanks   Hi
ModuleNotFoundError: No module named 'distances-calculator'
ModuleNotFoundError: No module named 'distances-calculator'  Hi...: No module named 'distances-calculator' How to remove the ModuleNotFoundError: No module named 'distances-calculator' error? Thanks   Hi
ModuleNotFoundError: No module named 'jas-calculator'
ModuleNotFoundError: No module named 'jas-calculator'  Hi, My... named 'jas-calculator' How to remove the ModuleNotFoundError: No module named 'jas-calculator' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'loan-calculator'
ModuleNotFoundError: No module named 'loan-calculator'  Hi, My... named 'loan-calculator' How to remove the ModuleNotFoundError: No module named 'loan-calculator' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'nn_calculator'
ModuleNotFoundError: No module named 'nn_calculator'  Hi, My... 'nn_calculator' How to remove the ModuleNotFoundError: No module named 'nn_calculator' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'pomodoro-calculator'
ModuleNotFoundError: No module named 'pomodoro-calculator'  Hi, My... named 'pomodoro-calculator' How to remove the ModuleNotFoundError: No module named 'pomodoro-calculator' error? Thanks   Hi
ModuleNotFoundError: No module named 'seguid-calculator'
ModuleNotFoundError: No module named 'seguid-calculator'  Hi, My... named 'seguid-calculator' How to remove the ModuleNotFoundError: No module named 'seguid-calculator' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'sz-calculator'
ModuleNotFoundError: No module named 'sz-calculator'  Hi, My... 'sz-calculator' How to remove the ModuleNotFoundError: No module named 'sz-calculator' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'aerospace-calculator'
ModuleNotFoundError: No module named 'aerospace-calculator'  Hi...: No module named 'aerospace-calculator' How to remove the ModuleNotFoundError: No module named 'aerospace-calculator' error? Thanks   Hi
ModuleNotFoundError: No module named 'arithmetic-calculator'
ModuleNotFoundError: No module named 'arithmetic-calculator'  Hi...: No module named 'arithmetic-calculator' How to remove the ModuleNotFoundError: No module named 'arithmetic-calculator' error? Thanks   Hi
ModuleNotFoundError: No module named 'currency-calculator'
ModuleNotFoundError: No module named 'currency-calculator'  Hi, My... named 'currency-calculator' How to remove the ModuleNotFoundError: No module named 'currency-calculator' error? Thanks   Hi
ModuleNotFoundError: No module named 'distances-calculator'
ModuleNotFoundError: No module named 'distances-calculator'  Hi...: No module named 'distances-calculator' How to remove the ModuleNotFoundError: No module named 'distances-calculator' error? Thanks   Hi
ModuleNotFoundError: No module named 'fibonaci-calculator'
ModuleNotFoundError: No module named 'fibonaci-calculator'  Hi, My... named 'fibonaci-calculator' How to remove the ModuleNotFoundError: No module named 'fibonaci-calculator' error? Thanks   Hi
ModuleNotFoundError: No module named 'GDD-Calculator'
ModuleNotFoundError: No module named 'GDD-Calculator'  Hi, My... named 'GDD-Calculator' How to remove the ModuleNotFoundError: No module named 'GDD-Calculator' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'jas-calculator'
ModuleNotFoundError: No module named 'jas-calculator'  Hi, My... named 'jas-calculator' How to remove the ModuleNotFoundError: No module named 'jas-calculator' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'arithmetic-calculator'
ModuleNotFoundError: No module named 'arithmetic-calculator'  Hi...: No module named 'arithmetic-calculator' How to remove the ModuleNotFoundError: No module named 'arithmetic-calculator' error? Thanks   Hi
ModuleNotFoundError: No module named 'Dewpoint-Calculator'
ModuleNotFoundError: No module named 'Dewpoint-Calculator'  Hi, My... named 'Dewpoint-Calculator' How to remove the ModuleNotFoundError: No module named 'Dewpoint-Calculator' error? Thanks   Hi
ModuleNotFoundError: No module named 'Dewpoint-Calculator'
ModuleNotFoundError: No module named 'Dewpoint-Calculator'  Hi, My... named 'Dewpoint-Calculator' How to remove the ModuleNotFoundError: No module named 'Dewpoint-Calculator' error? Thanks   Hi
ModuleNotFoundError: No module named 'Dewpoint-Calculator'
ModuleNotFoundError: No module named 'Dewpoint-Calculator'  Hi, My... named 'Dewpoint-Calculator' How to remove the ModuleNotFoundError: No module named 'Dewpoint-Calculator' error? Thanks   Hi
ModuleNotFoundError: No module named 'engineering-calculator'
ModuleNotFoundError: No module named 'engineering-calculator'  Hi...: No module named 'engineering-calculator' How to remove the ModuleNotFoundError: No module named 'engineering-calculator' error? Thanks   Hi
ModuleNotFoundError: No module named 'fbp_calculator'
ModuleNotFoundError: No module named 'fbp_calculator'  Hi, My... named 'fbp_calculator' How to remove the ModuleNotFoundError: No module named 'fbp_calculator' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'jas-calculator'
ModuleNotFoundError: No module named 'jas-calculator'  Hi, My... named 'jas-calculator' How to remove the ModuleNotFoundError: No module named 'jas-calculator' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'matrix-calculator'
ModuleNotFoundError: No module named 'matrix-calculator'  Hi, My... named 'matrix-calculator' How to remove the ModuleNotFoundError: No module named 'matrix-calculator' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'opacity_calculator'
ModuleNotFoundError: No module named 'opacity_calculator'  Hi, My... named 'opacity_calculator' How to remove the ModuleNotFoundError: No module named 'opacity_calculator' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'pomodoro-calculator'
ModuleNotFoundError: No module named 'pomodoro-calculator'  Hi, My... named 'pomodoro-calculator' How to remove the ModuleNotFoundError: No module named 'pomodoro-calculator' error? Thanks   Hi
ModuleNotFoundError: No module named 'rdt_calculator'
ModuleNotFoundError: No module named 'rdt_calculator'  Hi, My... named 'rdt_calculator' How to remove the ModuleNotFoundError: No module named 'rdt_calculator' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'rpn_calculator'
ModuleNotFoundError: No module named 'rpn_calculator'  Hi, My... named 'rpn_calculator' How to remove the ModuleNotFoundError: No module named 'rpn_calculator' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'sla-calculator'
ModuleNotFoundError: No module named 'sla-calculator'  Hi, My... named 'sla-calculator' How to remove the ModuleNotFoundError: No module named 'sla-calculator' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'sla-calculator'
ModuleNotFoundError: No module named 'sla-calculator'  Hi, My... named 'sla-calculator' How to remove the ModuleNotFoundError: No module named 'sla-calculator' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'Temu-Calculator'
ModuleNotFoundError: No module named 'Temu-Calculator'  Hi, My... named 'Temu-Calculator' How to remove the ModuleNotFoundError: No module named 'Temu-Calculator' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'agnostic-calculator'
ModuleNotFoundError: No module named 'agnostic-calculator'  Hi, My... named 'agnostic-calculator' How to remove the ModuleNotFoundError: No module named 'agnostic-calculator' error? Thanks   Hi
ModuleNotFoundError: No module named 'calculator-test'
ModuleNotFoundError: No module named 'calculator-test'  Hi, My... named 'calculator-test' How to remove the ModuleNotFoundError: No module named 'calculator-test' error? Thanks   Hi, In your python

Ads