Answered step by step
Verified Expert Solution
Question
1 Approved Answer
? 0 This progran calculates the BMI of the user. It starts by asking the user for their name and displays a customized welcome message.Using
This progran calculates the BMI of the user. It starts by asking the user
for their name and displays a customized welcome message.Using the user's
name the program asks the user for their weight and height and then calculates
the BMI usingthe formula weight bheight in where is
the conversion factor. Then the progron prints the BMI of the user and a
thank you message before quitting
import Javax.swing.JoptionPane;
public class BMICalculator
public static void main String args
final int CONVERSIONFACTOR ;
welcomeCONVERSIONFACTOR;
double userBMI clculateBMI userName;
printBMI userName userBMI;
thankYouuserName;
public static vold welcomefinal CF
String name JOptionPane.showInputDialogPlease Enter your first name";
To calculate your BMI this calculator uses the following formulan
"Formula: weight lbheight in;
JoptionPane, showles sageDialognull welcometsg;
return name;
public static double calculateBMIString int CF
double weight Double.parseDoubleJOptionPaneshowInputDialogPlease Enter your weight in pounds";
double height JoptionPane.showInputDialogPlease "Enter your Height in inches";
double bml welght helighthelight CF;
public static void printBMIString double bmi
string bmiMsg your BMI is bmi;
JOptionPane, showllessageDialogbmilsg;
public static void thankYouString
JoptionPane,showInputDialogThank you for using our calculator!!!";
Download BMICalculator. java and debug the program to correctly give the output as
shown below.
Hint: There are at most two errorsmissing word in each of the methods in BMICalculator class
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started