hello all
first thank all for ur effort in this website it is a fantastic work .....
second i want ur help because i'm a beginner student in java, i just know about java for 3 hours ago and i wnt to make a calculator so ii try to write code and it not work so hope u help me, the problem is the code dont give me result just give me 0 in all time.
note: i just do the addetion part because the lest will repeat like it.
Code:
import javax.swing.*;
public class Calc {
public static void main(String[] args) {
String s1=JOptionPane.showInputDialog(null,"Enter First Num\n");
String s2=JOptionPane.showInputDialog(null,"Enter The Sign\n");
String s3=JOptionPane.showInputDialog(null,"Enter The Second Num\n");
int result;
int x1=Integer.parseInt(s1);
int x2=Integer.parseInt(s3);
result=0;
if (s2==("+"))
result=x1+x2;
JOptionPane.showMessageDialog(null,""+result);
}
}