Advertisement
Guest User

Untitled

a guest
Jan 24th, 2017
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. import java.util.Scanner;
  2. import java.math.*;
  3.  
  4. public class ContainerCalculator
  5. {
  6. public static void main(String[] args)
  7. {
  8. double r, h, d, volume;
  9. Scanner scnr;
  10.  
  11. System.out.println("Welcome to the Container Calculator!");
  12. System.out.println("====================================");
  13. scnr = new Scanner(System.in);
  14.  
  15. System.out.println("Enter the diameter of a cylinder(in centimeters): ");
  16. d = scnr.nextDouble();
  17. System.out.println("Enter the height of a cylinder (in centimeters): " );
  18. h = scnr.nextDouble();
  19.  
  20. r = 1/2 * d;
  21. volume = ((22*r*r*h)/7);
  22. System.out.println("your volume is: " + volume);
  23.  
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement