Cory+Starman+Java

/**BMICalculator.java finds your BMI using your weight and height.




 * @author Cory





import java.util.Scanner; //imports the scanner public class BMICalculator {

public static void main(String[] args) { //these two lines are needed for the program to do anything at all Scanner keyboard = new Scanner(System.in); // this allows keyboard to be a scanner variable, and allows the program to read what keys I type

System.out.print("Enter your height in inches: "); //programs asks to enter the height double height = keyboard.nextDouble; //Sets the height as a variable with the value being what was typed

System.out.print("Enter your weight in pounds: "); //program asks to enter the weight. double weight = keyboard.nextDouble; //Sets the weight as a variable with the value being what you type in.

double measure1 = height * height; //multiples the height by itself and makes a new variable double measure2 = weight/measure1; // Divides the weight by measure 1 and makes a new variable double BMI = measure2 * 703; //multiples measure2, finding the BMI

System.out.printf("Your BMI is: %3.2f ", BMI); //The program tells you what your BMI is. I use placeholders so I can choose the width and precision. } }