Question

EASY JAVA PROGRAM 10. Write a program called CalculateBMI. Ask the user for their height in...

EASY JAVA PROGRAM

10. Write a program called CalculateBMI. Ask the user for their height in inches and their weight in pounds. Then, compute and report their BMI. You will need to look up the formula for BMI online and perform any necessary unit conversions. Print the result with two digits after the decimal place

0 0
Add a comment Improve this question Transcribed image text
Answer #1

import java.util.*;

class CalculateBMI
{
public static void main(String args[])
{
int height,weight;
double bmi;
Scanner sc=new Scanner(System.in);

System.out.print("Enter weight in pounds : ");
weight=sc.nextInt();

System.out.print("Enter height in inches : ");
height=sc.nextInt();


bmi=(double)(weight*703)/(height*height);
System.out.printf("BMI : %.2f",bmi);
System.out.println("\n");
}
}

Add a comment
Know the answer?
Add Answer to:
EASY JAVA PROGRAM 10. Write a program called CalculateBMI. Ask the user for their height in...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • /////////////////////////////////////////////////////////////////////////////////// //This program // 1. asks the user her/his weight and height // 2. then calculates...

    /////////////////////////////////////////////////////////////////////////////////// //This program // 1. asks the user her/his weight and height // 2. then calculates the user's body-mass-index (BMI) // 3. and then prints an appropriate message based on the user's BMI /////////////////////////////////////////////////////////////////////////////////// #include <iostream> using namespace std; void printWelcome(); // ask the weight (in pounds) and height (in inches) of the user and store the values in formal // parameters weight and height, respectively void getWeightAndHeight(float& weight, float& height); // calculate and return the BMI (Body-Mass-Index) based on...

  • Write a Java program that performs these operations Prompt the user to enter a low height...

    Write a Java program that performs these operations Prompt the user to enter a low height in feet (an integer) Prompt the user to enter a high height in feet (an integer) Prompt the user to enter a low weight in pounds (an integer) Prompt the user to enter a high weight in pounds (an integer) Print a table of Body Mass Index (BMI) for the heights and weights entered, ranging from the low height to the high height (inclusive),...

  • c++ pls 10D yUur Tugt Sna you will have to re-take it at another time PROBLEM...

    c++ pls 10D yUur Tugt Sna you will have to re-take it at another time PROBLEM 1 Body Mass Index (BMI) is a measure of body fat that is useful in screening for health issues. To calculate a BMi, you need the height in inches and the weight in pounds. You square the height, then divide the weight in pounds by the squared-height. BMI is defined in terms of meters and kilograms, so to convert from pounds and inches to...

  • IT Java code In Lab 8, we are going to re-write Lab 3 and add code...

    IT Java code In Lab 8, we are going to re-write Lab 3 and add code to validate user input. The Body Mass Index (BMI) is a calculation used to categorize whether a person’s weight is at a healthy level for a given height. The formula is as follows:                 bmi = kilograms / (meters2)                 where kilograms = person’s weight in kilograms, meters = person’s height in meters BMI is then categorized as follows: Classification BMI Range Underweight Less...

  • In Java Write a program that will ask the user for integers and print if the...

    In Java Write a program that will ask the user for integers and print if the integer is positive, negative or zero. The program should continue asking for integer until the user enters a negative value.

  • I am having problems with my java homework in class. Write a program that will interactively...

    I am having problems with my java homework in class. Write a program that will interactively read the name, age, weight in pounds, and height in inches for five people and output the BMI for each one. At the end of the program, it should output the average age, average height and average weight of the five participants. IT HAS TO INCLUDE: Declare and use a program constant of data type int named CONVERSION_FACTOR to represent the value 703. Use...

  • Write a short program in Java that asks the user for an integer. Then ask the...

    Write a short program in Java that asks the user for an integer. Then ask the user for a letter. Print out the letter followed by the integer.

  • In Java Body mass index is a measure of whether someone's weight is appropriate for their...

    In Java Body mass index is a measure of whether someone's weight is appropriate for their height. A body- mass-index value between 19 and 25 is considered to be in the normal range. Here's the formula for calculating body mass index: BMI- (704 x weight in pounds) / height in inches*2 a) Implement a program that prompts the user for height and weight values and displays the associated body mass index. Perform input validation by making sure that the user...

  • Write a program in java. You are tasked with writing an application that will keep track...

    Write a program in java. You are tasked with writing an application that will keep track of Insurance Policies. Create a Policy class called InsurancePolicies.java that will model an insurance policy for a single person. Use the following guidelines to create the Policy class: • An insurance policy has the following attributes: o Policy Number o Provider Name o Policyholder’s First Name o Policyholder’s Last Name o Policyholder’s Age o Policyholder’s Smoking Status (will be “smoker” or “non-smoker”) o Policyholder’s...

  • Write a program to print the hollow diamond of stars (*), ask the user to enter...

    Write a program to print the hollow diamond of stars (*), ask the user to enter an odd number as the height. For example, if user enters height as 7, output will look like: Y*

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT