import java.io.*;
import java.util.*;

public class UnitConverter{
	BufferedReader bf;
	public static void main (String[] args) throws Exception{
		UnitConverter Un = new UnitConverter();
    }
	public UnitConverter() throws Exception{
		bf = new BufferedReader(new InputStreamReader(System.in));
		int TableChoice;
		boolean done = false;
		while (!done) {
			TableChoice = runMenu();
			switch (TableChoice) {
				case 1:	System.out.println("convertGramsToPounds");
				convertGramsToPounds();
				break;
				case 2:	System.out.println("convertGramsToOunce");
				convertGramsToOunce();
				break;
				case 3:	System.out.println("convertKilogramsToPounds"); 
				convertKilogramsToPounds();
				break;
				case 4:	System.out.println("convertPoundsToKilograms"); 
				convertPoundsToKilograms();
				break;
				default: System.out.println("Quiting..."); 
				System.exit(0);
				break;
			}
		}
	}
	
	public int runMenu() throws Exception{
		int TableChoice;
		System.out.println();
		System.out.println("Conversion Table:");
		System.out.println("-------------------------");
		System.out.println("1. Grams To Pounds");
		System.out.println("2. Grams To Ounce");
		System.out.println("3. Kilograms To Pounds");
		System.out.println("4. Pounds To Kilograms");
		System.out.println("5. Quit");
		System.out.println("-------------------------");
		System.out.print("Choice: ");
		TableChoice = Integer.parseInt(bf.readLine());
		while (TableChoice < 1 || TableChoice > 5) {
			System.out.print("Invalid choice, try again: ");
			TableChoice = Integer.parseInt(bf.readLine());
		}
		System.out.println();
		return TableChoice;
	}
	
	public void convertGramsToPounds() throws Exception{
		System.out.print("Enter the Grams:");
		int gram = Integer.parseInt(bf.readLine());
		double pound = gram * 0.00220462262;
		System.out.println("Pound: " + pound);
	}
	
	public void convertGramsToOunce() throws Exception{
		System.out.print("Enter the Grams:");
		int gram = Integer.parseInt(bf.readLine());
		double Ounce = gram * 0.035273962;
		System.out.println("Ounce:" + Ounce);
	}
	
	public void convertKilogramsToPounds() throws Exception{
		System.out.print("Enter the Kilogram:");
		int kilo = Integer.parseInt(bf.readLine());
		double pond = kilo * 2.20462262;
		System.out.println("Ponds: " + pond);
	}
	
	public void convertPoundsToKilograms() throws Exception{
		System.out.println("Enter the Pounds:");
		int pound = Integer.parseInt(bf.readLine());
		double kilo = pound * 0.45;
		System.out.println("Kilo: " + kilo);
	}
}