Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Program is supposed to calculate persons BMI import java.util.scanner; public cl

ID: 3647463 • Letter: P

Question

Program is supposed to calculate persons BMI
import java.util.scanner;


public class BMI{


public static void main(String args[]){


Scanner input=Scanner(System.in);


//Declaring variables for height and weight
double height;

double weight;
//prompting for input
System.out.print("Enter Height in Meters : ");

height=input.nextDouble();

System.out.print("Enter Weight in Kilograms : ");

weight=input.nextDouble();

double BMI;
//Calculating BMI
BMI=weight/(height*height);

System.out.println(" Your BMI is: "+BMI);
}
}

Explanation / Answer

please rate - thanks

I've highliged the 2 lines that had errors. both had to do with Scanner

import java.util.Scanner;
public class BMI{
public static void main(String args[]){
Scanner input= new Scanner(System.in);
//Declaring variables for height and weight
double height;
double weight;
//prompting for input
System.out.print("Enter Height in Meters : ");
height=input.nextDouble();
System.out.print("Enter Weight in Kilograms : ");
weight=input.nextDouble();
double BMI;
//Calculating BMI
BMI=weight/(height*height);

System.out.println(" Your BMI is: "+BMI);
}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote