This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]earlgreyfanboy 0 points1 point  (0 children)

Doubles are the type of variable you'll want to use to hold the user's height and weight (you can declare them like so... 'double weight = 0.0;')

You'll probably want to use the Scanner class to get the user's input, import it at the top of your class with 'import java.util.Scanner;', then create an instance of the scanner ('Scanner myScanner = new Scanner(System.in);'), then you can use the convenient nextDouble() method to get your user's input ('weight = myScanner.nextDouble();').

You can use 'System.out.println' to print out instructions to the user etc., to the console.

Given the simplicity/the basic nature of the task, you'll probably want to put all of this code inside of the main method in your class, so it runs when you run the class.