Question:

Create a calculator in java?

by  |  earlier

0 LIKES UnLike

Create a calculator in java?

 Tags:

   Report

4 ANSWERS


  1. Umm well that's alot more complicated than you think but this should get you started.

    public class mathematics

    {

    public static void main(String[] args)

    {

    //Declaration Section



    EasyReader console = new EasyReader();



    int sum1, sum2, dif1, dif2, product1, product2, quote1, quote2, remainder1, remainder2, number1, number2;

    String name, lastname, snumber1, snumber2;





    //Input Section



    System.out.print("Enter your first name: ");

    name = console.readLine();



    System.out.print("Enter your last name: ");

    lastname = console.readLine();



    System.out.print("Enter an integer: ");

    snumber1 = console.readLine();

    number1 = Integer.parseInt(snumber1);



    System.out.print("Enter another integer: ");

    snumber2 = console.readLine();

    number2 = Integer.parseInt(snumber2);





    //Calculation

    sum1 = number1 + number2;

    sum2 = number2 + number1;



    dif1 = number1 - number2;

    dif2 = number2 - number1;



    product1 = number1 * number2;

    product2 = number2 * number1;



    quote1 = number1 / number2;

    quote2 = number2 / number1;



    remainder1 = number1 % number2;

    remainder2 = number2 % number1;





    //Output

    System.out.println("\nHello " + name + " " + lastname + "!" );



    System.out.println("\nHere are your math operation results:");



    System.out.println("\n" + number1 + " + " + number2 + " = " + sum1);

    System.out.println(number2 + " + " + number1 + " = " + sum2);



    System.out.println("\n" + number1 + " - " + number2 + " = " + dif1);

    System.out.println(number2 + " - " + number1 + " = " + dif2);



    System.out.println("\n" + number1 + " x " + number2 + " = " + product1);

    System.out.println(number2 + " x " + number1 + " = " + product2);



    System.out.println("\n" + number1 + " / " + number2 + " = " + quote1);

    System.out.println(number2 + " / " + number1 + " = " + quote2);



    System.out.println("\n" + number1 + " % " + number2 + " = " + remainder1);

    System.out.println(number2 + " % " + number1 + " = " + remainder2);



    System.out.println("\n\n\nHave a nice day ! :D");



        


  2. graphics design-

    http://userstyle.org/

  3. Java is as close to a traditional programming environment as anything modern goes, save for C++.Managed.NET and C#

    Done that before, to make a real scientific calculator that can do + - * / ^ % ! () cos sin tan arc or even simpler arithmetic following precedence rules in math you'll need to know binary trees and parsing, it is not as easy as JavaScript where you just call the engine out to do the math as piece of code.

  4. What's the question? do you want a calculator script? just type java calculator script into google, there are many to find on the net

Question Stats

Latest activity: earlier.
This question has 4 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.
Unanswered Questions