merlijne

ConvertFootMeters

Nov 24th, 2020
410
124 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.Scanner;
  2.  
  3. //1 Foot (ft) is equal to 0.3048 meter (m). To convert feet to meters, multiply
  4. //the foot value by 0.3048 or divide by 3.280839895.
  5.  
  6. public class ConvertFootMeters {
  7.  
  8.     public static void main(String[] args) {
  9.         Scanner input = new Scanner(System.in);
  10.        
  11.         //USER INPUT
  12.         System.out.println("How many foot do you need to convert to meters?");
  13.         System.out.println("Type in foot in number and press enter: ");
  14.         Double foot = input.nextDouble();
  15.        
  16.         Double meters = foot * 0.3048;//The calculation
  17.        
  18.         //OUTPUT IN YOURE CONSOLE
  19.         System.out.println(String.valueOf(foot) + "foot = " + meters + " meters.");
  20.  
  21.     }
  22.  
  23. }
RAW Paste Data