Twitter Feed Facebook Google Plus Youtube

Adsense responsive

Recent Post below header

Thursday, 21 February 2013

JAVA PROGRAM: TO ADD, SUBTRACT, MULTIPLY, DIVIDE TWO NUMBERS



CODING OF ADD BUTTON(jButton1)
    {
        int num1,num2,sum;
        num1=Integer.parseInt(jTextField1.getText());
        num2=Integer.parseInt(jTextField2.getText());
        sum=num1+num2;
        jTextField3.setText(" "+sum);
    }

CODING OF SUBTRACT BUTTON(jButton2)
    {
        int num1,num2,sub;
        num1=Integer.parseInt(jTextField1.getText());
        num2=Integer.parseInt(jTextField2.getText());
        sub=num1-num2;
        jTextField3.setText(" "+sub);
    }

CODING OF MULTIPLY BUTTON(jButton3)
    {
        int num1,num2,mul;
        num1=Integer.parseInt(jTextField1.getText());
        num2=Integer.parseInt(jTextField2.getText());
        mul=num1*num2;
        jTextField3.setText(" "+mul);
    }

CODING OF DIVIDE BUTTON(jButton4)

    {
        int num1,num2;
        float div;
        num1=Integer.parseInt(jTextField1.getText());
        num2=Integer.parseInt(jTextField2.getText());
        div=(float)num1/num2;
        jTextField3.setText(" "+div);
    }

CODING OF CLEAR BUTTON(jButton5)

    {
        jTextField1.setText(" ");
        jTextField2.setText(" ");
        jTextField3.setText(" ");
    }

CODING OF EXIT BUTTON(jButton6)

    {
        System.exit(0);
    }


CODING

RUNNING

We have used NetBeans IDE 7.2.1. To download it visit www.netbeans.org


For any query or suggestion please comment below...

1 comment:

  1. I am extremely grateful to u for giving more valuable information..presentations

    ReplyDelete