Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import javax.swing.JOptionPane;
- public class sample6
- {
- public static void main(String[] args){
- double area, circumference;
- int radius;
- String strRadius,outputStr;
- strRadius = JOptionPane.showInputDialog("Enter value of radius:");
- radius = Integer.parseInt(strRadius);
- area = Math.PI * (radius * radius);
- circumference = 2 * Math.PI * radius;
- outputStr = String.format("The RADIUS is %d%n ", radius) +
- String.format("The AREA is %.2f%n" , area) +
- String.format("The CIRCUMFERENCE is %.2f", circumference);
- JOptionPane.showMessageDialog(null,outputStr, "COMPUTATION",
- JOptionPane.INFORMATION_MESSAGE);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement