Empowering The World Through Technology

Create Calculator in java through java programming

Create Calculator in java by java programming. The way to create a calculator by java programming? To create a program for calculator utilizing java language is bit robust. however from elmseekho.com you may be taught that how can we create a program of calculator creation.

Right here is full verified coding for creating calculator. You simply must run this coding in your command immediate (cmd) utilizing Java growth equipment (jdk) 1.6 or extra.

Right here can be totally different java and asp.web applications like:

  1. The way to join java with database|Utilizing JDBC-ODBC Connection string
  2. The way to Create combo field in java|Full Coding
  3. Java program to calculate Age from Date of delivery
  4. The way to create a Recruitment or job announcement web page in asp.web | Full entrance finish designing and backend coding
  5. The way to Add a number of textbox values and displaying their sum
  6. Worker Registration type | Creation of Registration type in visible studio utilizing c# and asp.web
  7. How add new webpage in a web site utilizing C#, asp.web in visible studio.
  8. The way to create login web page utilizing asp.web and C#
Create Calculator through java programming
Create Calculator in java by java programming

Full Java Program to create calculator in java.
import java.awt.;
import java.awt.occasion.;

class calframe extends Body implements ActionListener
{
int x,y,op;

TextField txt;
Label lb;

String value1,value2;

Button decbt17,rembt18,offbt19,onbt20,ninebt1, eightbt2, sevenbt3, ACbt4, sixbt5, fivebt6, fourbt7, dividbt8, threebt9, twobt10, onebt11, multibt12,
zerobt13, equalbt14, addbt15,subbt16;

calframe( )
{tremendous(” KK-328A”);
setBounds(200,100,270,370);
tremendous.setFont(new Font(“Instances New Roman”,Font.BOLD,12));
addWindowListener(new WindowAdapter( )
{
public void windowClosing(WindowEvent we)
{
dispose();
}
});

setLayout(null);

txt=new TextField(40);
txt.setFont(new Font(“Instances New Roman”, Font.BOLD,36));
txt.setBounds(30,60,210,50);

lb=new Label(“”);
lb.setBounds(10,60,10,10);
lb.setFont(new Font(“Instances New Roman”,Font.BOLD,12));

decbt17=new Button(“.”);
decbt17.setBounds(20,140,50,25);
decbt17.addActionListener(this);

rembt18=new Button(“%”);
rembt18.setBounds(80,140,50,25);
rembt18.addActionListener(this);

offbt19=new Button(“off”);
offbt19.setBounds(140,140,50,25);
offbt19.addActionListener(this);

onbt20=new Button(“on”);
onbt20.setBounds(200,140,50,25);
onbt20.addActionListener(this);

sevenbt3=new Button(“7”);
sevenbt3.setBounds(20,180,50,25);
sevenbt3.addActionListener(this);

eightbt2=new Button(“8”);
eightbt2.setBounds(80,180,50,25);
eightbt2.addActionListener(this);

ninebt1=new Button(“9”);
ninebt1.setBounds(140,180,50,25);
ninebt1.addActionListener(this);

ACbt4=new Button(“AC”);
ACbt4.setBounds(200,180,50,25);
ACbt4.addActionListener(this);

Top Trending

fourbt7=new Button(“4”);
fourbt7.setBounds(20,220,50,25);
fourbt7.addActionListener(this);

fivebt6=new Button(“5”);
fivebt6.setBounds(80,220,50,25);
fivebt6.addActionListener(this);

sixbt5=new Button(“6”);
sixbt5.setBounds(140,220,50,25);
sixbt5.addActionListener(this);

dividbt8=new Button(“/”);
dividbt8.setBounds(200,220,50,25);
dividbt8.addActionListener(this);

onebt11=new Button(“1”);
onebt11.setBounds(20,260,50,25);
onebt11.addActionListener(this);

twobt10=new Button(“2”);
twobt10.setBounds(80,260,50,25);
twobt10.addActionListener(this);

threebt9=new Button(“3”);
threebt9.setBounds(140,260,50,25);
threebt9.addActionListener(this);

multibt12=new Button(“*”);
multibt12.setBounds(200,260,50,25);
multibt12.addActionListener(this);

zerobt13=new Button(“0”);
zerobt13.setBounds(20,300,50,25);
zerobt13.addActionListener(this);

equalbt14=new Button(“=”);
equalbt14.setBounds(80,300,50,25);
equalbt14.addActionListener(this);

addbt15=new Button(“+”);
addbt15.setBounds(140,300,50,25);
addbt15.addActionListener(this);

subbt16=new Button(“-“);
subbt16.setBounds(200,300,50,25);
subbt16.addActionListener(this);

add(txt);
add(lb);
add(ninebt1);
add(eightbt2);
add(sevenbt3);
add(ACbt4);
add(sixbt5);
add(fivebt6);
add(dividbt8);
add(fourbt7);
add(threebt9);
add(twobt10);
add(onebt11);
add(multibt12);
add(zerobt13);
add(equalbt14);
add(addbt15);
add(subbt16);
add(decbt17);
add(rembt18);
add(offbt19);
add(onbt20);

value1=””;
value2=””;
op=0;
setVisible(true);

}
public void actionPerformed(ActionEvent ae)
{
if (ae.getSource()==ninebt1)
{
value1+=”9″;
txt.setText(value1);
}
if (ae.getSource()==eightbt2)
{
value1+=”8″;
txt.setText(value1);
}
if (ae.getSource()==sevenbt3)
{
value1+=”7″;
txt.setText(value1);
}
if (ae.getSource()==ACbt4)
{
value1=””;
txt.setText(value1);
}
if (ae.getSource()==sixbt5)
{
value1+=”6″;
txt.setText(value1);
}
if (ae.getSource()==fivebt6)
{
value1+=”5″;
txt.setText(value1);
}
if (ae.getSource()==dividbt8)
{
x = Integer.parseInt(value1);
value1=””;
txt.setText(value1);
op=4;
}
if (ae.getSource()==fourbt7)
{
value1+=”4″;
txt.setText(value1);
}
if (ae.getSource()==threebt9)
{
value1+=”3″;
txt.setText(value1);
}
if (ae.getSource()==twobt10)
{
value1+=”2″;
txt.setText(value1);
}
if (ae.getSource()==onebt11)
{
value1+=”1″;
txt.setText(value1);
}
if (ae.getSource()==multibt12)
{
x = Integer.parseInt(value1);
value1=””;
txt.setText(value1);
op=3;
}
if (ae.getSource()==zerobt13)
{
value1+=”0″;
txt.setText(value1);
}
if (ae.getSource()==equalbt14)
{
int c;
if(op==1)
{
y=Integer.parseInt(value1);
c = x + y;
txt.setText(value2.valueOf(c));
}

if(op==2)
{
y=Integer.parseInt(value1);
c = x – y;
txt.setText(value2.valueOf(c));
}

if(op==3)
{
y=Integer.parseInt(value1);
c = x * y;
txt.setText(value2.valueOf(c));
}

if(op==4)
{
y=Integer.parseInt(value1);
c = x / y;
txt.setText(value2.valueOf(c));
}

}
if (ae.getSource()==addbt15)
{
x = Integer.parseInt(value1);
value1=””;
txt.setText(value1);
lb.setText(“+”);
op=1;
}
if (ae.getSource()==subbt16)
{
x = Integer.parseInt(value1);
value1=””;
txt.setText(value1);
op=2;
}
}
}

class calculate
{
public static void foremost(String str[])
{
calframe f=new calframe();
}
}

  1. The way to join java with database|Utilizing JDBC-ODBC Connection string
  2. The way to Create combo field in java|Full Coding
  3. Java program to calculate Age from Date of delivery
  4. The way to create a Recruitment or job announcement web page in asp.web | Full entrance finish designing and backend coding
  5. The way to Add a number of textbox values and displaying their sum
  6. Worker Registration type | Creation of Registration type in visible studio utilizing c# and asp.web
  7. How add new webpage in a web site utilizing C#, asp.web in visible studio.
  8. The way to create login web page utilizing asp.web and C#
Leave A Reply

Your email address will not be published.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More