I want to show the BMI using JOptionPane.showMessageDialog method showing their full name and BMI.What am I doing wrong ?
Can you explain what the program does that is "wrong"?
NormR1
Posting Sage
7,742 posts since Jun 2010
Reputation Points: 1,158
Solved Threads: 793
Skill Endorsements: 16
Try this:
double results = kilo * sqrt(metre);
String response= results + " " + FirstName + " " + Lastname;
rubberman
Posting Maven
2,571 posts since Mar 2010
Reputation Points: 365
Solved Threads: 305
Skill Endorsements: 52
NormR1
Posting Sage
7,742 posts since Jun 2010
Reputation Points: 1,158
Solved Threads: 793
Skill Endorsements: 16
The posted error messages left off the source code line numbers.
parseInt(String) in the type Integer is not applicable for the arguments (double)
The parseInt() method requires a String for its arg, not a double. What data are you trying to convert to an int?
The method sqrt(int) is undefined
The compiler can not find a definition for the method: sqrt()? What class is it defined in?
Where is it defined?
Type mismatch: cannot convert from double to int
What line did this error happen on?
NormR1
Posting Sage
7,742 posts since Jun 2010
Reputation Points: 1,158
Solved Threads: 793
Skill Endorsements: 16
What do you do with the height and weight values that the user enters in response to the JOptionPane prompts? Should the String that the user entered be converted to a numeric value so you can do arithmetic with it to compute the values you want to display?
NormR1
Posting Sage
7,742 posts since Jun 2010
Reputation Points: 1,158
Solved Threads: 793
Skill Endorsements: 16