Answered step by step
Verified Expert Solution
Link Copied!

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

?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 the user's
name the program asks the user for their weight and height and then calculates
the BMI usingthe formula weight (1b)/[height (in)]^2703, where 703 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 CONVERSION_FACTOR =703;
welcome(CONVERSION_FACTOR);
double userBMI - clculateBMI (userName);
printBMI (userName, userBMI);
]
thankYou(userName);
public static vold welcome(final CF){
String name = JOptionPane.showInputDialog("Please Enter your first name");
"To calculate your BMI this calculator uses the following formulan"+
"Formula: weight (lb)/[height (in)]^2x=+CF;
JoptionPane, showles sageDialog(null, welcome/tsg);
}
return name;
public static double calculateBMI(String n, int CF){
double weight = Double.parseDouble(JOptionPane.showInputDialog("Please"+n+" Enter your weight in pounds"));
double height - JoptionPane.showInputDialog("Please "+n+ "Enter your Height in inches");
}
double bml = welght /(helight*helight)* CF;
public static void printBMI(String n, double bmi)(
string bmiMsg =n+" your BMI is "+ bmi;
JOptionPane, showllessageDialog(bmilsg);
}
public static void thankYou(String n){
JoptionPane,showInputDialog("Thank 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 errors/missing word in each of the methods in BMICalculator class
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

=+2 Is the decision sustainable in the long run?

Answered: 1 week ago