This is my first java class and if someone can help me do this assignment. thank
ID: 3687738 • Letter: T
Question
This is my first java class and if someone can help me do this assignment. thanks
BMI stands for Body Mass Index. It is an attempt to quantify the amount of tissue mass in an and categorize that person as underweight, normal weight, overweight, or obese. Your assignments is to make a BMI calculator that accepts on the command line the users height in meters, and weight in kilograms. If you accept height in inches and weight in pounds. If you accept height in feet and inches. BMI is defined as the body mas (in kilograms) divided by the square of the height in meters. For the purpose of this assignment: There are 2.2 lb per kilogram. There are 39.5 inches per meter. Sample input (User input in underlined italics): Enter weight in kg middot 81.5 Enter height in meters middot 1.8 Your BMI is middot 25.2 For extra credit #1 Enter weight in lb middot 180 Enter height in inches middot 73 Your BMI is 24.0 For extra credit #2 Enter weight in pounds middot 210 Enter height in feet and inches 66 Your BMI is 24.5 Note: You must write a separate method to calculate the BMI index - do not do it in line. This method should take in the weight/height parameters are return the BMI value. You may assume proper input format (error checking is not required) Note that the BMI value should be accurate to one decimal place. IE 23.7 NOT 23.6982Explanation / Answer
import java.util.*;
class bmi_cal
{
public static void bmi_index(double kg, double mtr)
{
double bmi=kg/(mtr*mtr);
System.out.println("Your BMI is : "+bmi);
}
public static void main(String args[])
{
Scanner scan = new Scanner(System.in);
System.out.print("Enter weight in kg : ");
double kg=scan.nextDouble();
System.out.print("Enter height in meters : ");
double mtr=scan.nextDouble();
bmi_index(kg,mtr);
}
}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.