Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class UnitConversions
- {
- public static void main(String[] args)
- {
- Scanner in = new Scanner(System.in);
- double unitTotal = 0;
- System.out.println("Please enter a value:");
- String unitValue = in.nextLine();
- double doubleUnitValue = Double.valueOf(unitValue);
- System.out.println("Please enter a conversion type: \nGL for Gallons to Liters \nIC for Inches to Centimeters \nPK for Pounds to Kilograms \nMK for Miles to Kilometers");
- String unitType = in.nextLine();
- if(unitType == "GL")
- unitTotal = doubleUnitValue * 3.79;
- System.out.println(doubleUnitValue + " Gallons = " + unitTotal + " Liters.");
- //if(unitType == "IC")
- //unitTotal =
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement