Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. import javax.swing.JOptionPane;
  2. public class sample6
  3. {
  4. public static void main(String[] args){
  5. double area, circumference;
  6. int radius;
  7.  
  8. String strRadius,outputStr;
  9. strRadius = JOptionPane.showInputDialog("Enter value of radius:");
  10. radius = Integer.parseInt(strRadius);
  11. area = Math.PI * (radius * radius);
  12. circumference = 2 * Math.PI * radius;
  13.  
  14. outputStr = String.format("The RADIUS is %d%n ", radius) +
  15. String.format("The AREA is %.2f%n" , area) +
  16. String.format("The CIRCUMFERENCE is %.2f", circumference);
  17.  
  18. JOptionPane.showMessageDialog(null,outputStr, "COMPUTATION",
  19. JOptionPane.INFORMATION_MESSAGE);
  20.  
  21.  
  22.  
  23.  
  24. }
  25.  
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement