User and Programmer Interface:

Use Scanner class to take keyboard information.

Examples:

import java.util.Scanner;

public class Tester
{
	public static void main(String [] args)
	{
		int numOfUnits ;
		double unitPrice;
		double total;
		Scanner input = new Scanner(System.in);
		System.out.println("Enter number of units.");
		numOfUnits = input.nextInt();
		System.out.println("Enter unit price.");
		unitPrice = input.nextDouble();
		total = unitPrice * numOfUnits;
		System.out.printf("%20s%15s%15s\n","Number of Units","Unit Price","Total");
		System.out.printf("%20d%15.2f%15.2f",numOfUnits, unitPrice, total);
	}
}