Calculator

Ads
 

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;


}
}

}

Ads









Related Tutorials/Questions & Answers:
Calculator
Calculator  need a simple java program to degin a CALCULATOR without using ADVANCED JAVA....   Calculator in Java Swing
simple calculator program in javascript
simple calculator program in javascript  strong textsimple calculator in javascript
Advertisements
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
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
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 '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 '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 '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 '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
ModuleNotFoundError: No module named 'cloud-calculator'
ModuleNotFoundError: No module named 'cloud-calculator'  Hi, My... named 'cloud-calculator' How to remove the ModuleNotFoundError: No module named 'cloud-calculator' error? Thanks   Hi, In your
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 '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 '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 '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 '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 '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 '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 'GPIO-Calculator'
ModuleNotFoundError: No module named 'GPIO-Calculator'  Hi, My... named 'GPIO-Calculator' How to remove the ModuleNotFoundError: No module named 'GPIO-Calculator' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'interference-calculator'
ModuleNotFoundError: No module named 'interference-calculator'  Hi...: No module named 'interference-calculator' How to remove the ModuleNotFoundError: No module named 'interference-calculator' error? Thanks   
ModuleNotFoundError: No module named 'ivs-calculator'
ModuleNotFoundError: No module named 'ivs-calculator'  Hi, My... named 'ivs-calculator' How to remove the ModuleNotFoundError: No module named 'ivs-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 '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

Ads