Advertisement
Guest User

ganggangchef

a guest
Nov 20th, 2019
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1.  
  2. import java.util.Scanner;
  3.  
  4. public class SquareIt
  5. {
  6.  
  7. public static void main(String[] args)
  8. {
  9. // variable declaration section
  10. Scanner in = new Scanner (System.in);
  11. double Liters = 0;
  12. int LiterToGallon = 0;
  13.  
  14.  
  15.  
  16.  
  17. // code execution section
  18. System.out.println("Enter the Liters that you need to be converted to gallons");
  19. Liters = in.nextInt();
  20.  
  21. System.out.println(Liters + " Liters in gallons would be " + LiterToGallon(Liters) + " Gallons ");
  22. }
  23. public static double LiterToGallon(double number)
  24. {
  25. return(number / 3.785);
  26. }
  27.  
  28.  
  29.  
  30.  
  31. }
  32. // class method declaration section
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement