Arithmetic calculator.
G.U.I
Coding
for add button:
int
num1=Integer.parseInt(tf1.getText());
int
num2=Integer.parseInt(tf2.getText());
int
result=num1+num2;
tf3.setText(""+result);
}
coding
for subtract button:
int
num1=Integer.parseInt(tf1.getText());
int
num2=Integer.parseInt(tf2.getText());
int
result=num1-num2;
tf3.setText(""+result);
coding
for multiply button:
int
num1=Integer.parseInt(tf1.getText());
int
num2=Integer.parseInt(tf2.getText());
int
result=num1*num2;
tf3.setText(""+result);
coding
for division button:
int
num1=Integer.parseInt(tf1.getText());
int
num2=Integer.parseInt(tf2.getText());
int
result=num1/num2;
tf3.setText(""+result);
coding
for clear button:
tf1.setText("");
tf2.setText("");
tf3.setText("");
coding
for exit button
:
System.exit(0);
Run
time screenshot: