Hier ist mein Code. Aus irgendeinem Grund wird mein BMI nicht richtig berechnet. Wenn ich die Ausgabe auf einem Taschenrechner auf Folgendes überprüfe: (10/((10/100)^2)))Ich bekomme 1000, aber in meinem Programm bekomme ich 5. Ich bin nicht sicher, was ich falsch mache. Hier ist mein Code:
import javax.swing.*;
public class BMI {
public static void main(String args[]) {
int height;
int weight;
String getweight;
getweight = JOptionPane.showInputDialog(null, "Please enter your weight in Kilograms");
String getheight;
getheight = JOptionPane.showInputDialog(null, "Please enter your height in Centimeters");
weight = Integer.parseInt(getweight);
height = Integer.parseInt(getheight);
double bmi;
bmi = (weight/((height/100)^2));
JOptionPane.showMessageDialog(null, "Your BMI is: " + bmi);
}
}