import javax.swing.*;
public class Vergleich
{
public static void main (String []args)
{
String Rechenart = JOptionPane.showInputDialog (null, "Bitte + , - , * , / eingeben");
String Zahl1 = JOptionPane.showInputDialog (null, "Bitte erste Zahl eingeben");
String Zahl2 = JOptionPane.showInputDialog (null, "Bitte zweite Zahl eingeben");
double Ergebnis;
double i = Double.parseDouble (Zahl1);
double j = Double.parseDouble (Zahl2);
if (Rechenart.equals("+"))
{
Ergebnis = Zahl1 + Zahl2;
JOptionPane.showMessageDialog (null, "Ergebnis : " + Ergebnis );
}
else
{
if (Rechenart.equals("-"))
{
Ergebnis = i - j;
JOptionPane.showMessageDialog (null, "Ergebnis : " + Ergebnis);
}
else
{
if (Rechenart.equals("*"))
{
Ergebnis = i * j;
JOptionPane.showMessageDialog (null, "Ergebnis : " + Ergebnis);
}
else
{
if (Rechenart.equals("/"))
{
Ergebnis = i / j;
JOptionPane.showMessageDialog (null, "Ergebnis : " + Ergebnis);
}
else
{
JOptionPane.showMessageDialog (null, "Falsche Eingabe");
}
}
}
}
}
}