Guest User

Untitled

a guest
Jul 22nd, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. import javax.swing.JOptionPane;
  2.  
  3. public class Welcome {
  4. public static void main(String[] args)
  5. {
  6.  
  7. String inputa = JOptionPane.showInputDialog(null,"What is the radius?","I like turtles",JOptionPane.QUESTION_MESSAGE);
  8. double radius = Double.parseDouble(inputa);
  9.  
  10. String inputb = JOptionPane.showInputDialog(null,"What is the length?","I like turtles",JOptionPane.QUESTION_MESSAGE);
  11. double length = Double.parseDouble(inputb);
  12.  
  13. double double pi = 3.14159; //Wanted to use static double ;(
  14. double area = radius * radius * pi;
  15. double volume = area * length;
  16. System.out.println("The volume is " + volume);
  17.  
  18. }
Add Comment
Please, Sign In to add comment