import java.util.Scanner;
public class Main {
	
	static Scanner kbin;
	
	public static void main(String[] args) {
		
		kbin = new Scanner(System.in);
		String choice;
		
		do{
		    BMICalculator();
		    
		    System.out.println("Enter y to continue or any other key to quit: ");
		    choice = kbin.next();
		}while(choice.equalsIgnoreCase("y"));
		
		
		
	}
	
	public static void BMICalculator() {
		
		welcome();
		
		getHeight();
		
		getWeight();
		
		calculate();
		
		displayResult();
		
	}
	
	/*
	 * This function displays a message.
	 */
	public static void welcome() {
		System.out.println("Welcome to the BMI Caclulator!");
	}
	
	/*
	 * This function asks a user for a height in meters between 1.0 and 2.25 and returns the result
	 */
	public static double getHeight() {
		
		
		double h;
		
		System.out.println("Enter a height in meters: ");
		h = kbin.nextDouble();
		
		return h;
		
		
	}
	
	/*
	 * this function asks a user for a weight value as a whole number between 25 and 85 and returns the result
	 */
	public static int getWeight() {
		int w;
		
		System.out.println("Enter a weight value as a whole number: ");
		w = kbin.nextInt();
		
		return w;
	}
	
	/*this function takes a double and an integer as parameters, calculates BMI and returns a double value
	 * 
	 */
	public static double calculate(double heightValue, int weightValue) {
		
		double bmi = weightValue/Math.pow(heightValue, 2);
		
		return bmi;
	}
	
	/*
	 * This function takes a double as a parameter and displays the value in a meaningful sentence
	 */
	public static void displayResult(double displayValue) {
		
		System.out.println("The BMI is calculated to be "+displayValue);
	}

}
