public class BMICalculator { { public static void main ( ( String [ ] [ ] args
Fantastic news! We've Found the answer you've been seeking!
Question:
public class BMICalculator {
public static void main(String[] args){
Scanner scanner = new Scanner(System.in);
// Ask the user to enter their weight in kilograms
System.out.print("Enter your weight in kilograms: ");
double weight = scanner.nextDouble();
// Ask the user to enter their height in meters
System.out.print("Enter your height in meters: ");
double height = scanner.nextDouble();
// Calculate the BMI
double bmi = weight /(height * height);
// Print the calculated BMI
System.out.printf("Your BMI is %.2f", bmi);
}
} explain this program
Related Book For
Introduction to Java Programming, Comprehensive Version
ISBN: 978-0133761313
10th Edition
Authors: Y. Daniel Liang
Posted Date: