/** UnitPricer.java calculates the unit prices of two
 *    different items, given their prices and units.
 *    @author Joel Adams, for Alice+Java
 *    @version 1.0
 */
import java.util.Scanner;

public class UnitPricer {
	public static void main(String[] args) {
		Scanner kbd = new Scanner(System.in);
		// get the info for the first item
		System.out.print("Enter the price of the 1st item: ");
		double price1 = kbd.nextDouble();
		System.out.print("How many units are in the 1st item? ");
		double units1 = kbd.nextDouble();
		
		// get the info for the second item
		System.out.print("Enter the price of the 2nd item: ");
		double price2 = kbd.nextDouble();
		System.out.print("How many units are in the 2nd item? ");
		double units2 = kbd.nextDouble();
		
		// compute results
		double unitPrice1 = price1/units1;
		double unitPrice2 = price2/units2;
		
		// display results
		System.out.println();
		System.out.printf("Item 1 unit price: $%7.2f%n", unitPrice1);
        System.out.printf("Item 2 unit price: $%7.2f%n", unitPrice2);
   }
} // UnitPricer
