Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Language is Java. Calculate the Body Mass Index (BMI) given a weight in pounds and a height in inches. The BMI is defined as the

Language is Java.

Calculate the Body Mass Index (BMI) given a weight in pounds and a height in inches.

The BMI is defined as the body weight in kilograms divided by the square of the height in meters.

Convert pounds to kilograms by dividing pounds by 2.2;

Convert inches to meters by multiplying by 0.0254.

Use the Scanner class to get the user input from the keyboard, and display as output the weight in kilograms, the height in meters, and the BMI in kg/m2.

Use the static method Math.pow( ) to find the square of the height.

Use the following template:

import java.util.*;

public class BMI {

// pounds to kilograms

final static double CONVWGT = 2.2

// inches to meters

final static double CONVHGT = 0.0254;

public static void main (String [] args) {

double bmi;

Scanner input = new Scanner(System.in);

// put the problem solution here

System.out.printf( BMI: %.2f , bmi);

return;

}

}

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

Database Concepts

Authors: David M. Kroenke

1st Edition

0130086509, 978-0130086501

More Books

Students also viewed these Databases questions

Question

Determine miller indices of plane A Z a/2 X a/2 a/2 Y

Answered: 1 week ago