Well you can alway look in the Java API:
Java API
but the general method of getting input is:
import java.util.Scanner;
(class)
{
(main method)
{
Scanner scan* = new Scanner(System.in);
(prompt for input)
(object) = scan.next(); //Look in the API for other methods in Scanner class
there is also nextInt, nextDouble, etc;
You should now have an object with the value of the input, just input the object into the formula.
repeat the prompt and scan.next() or whichever Method you use for each variable
*You can also name the Scanner object anything you want it doesn't have to be "scan"
i hope this helps, if it just confuses you then ignore it.