Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. import java.text.DecimalFormat;
  2. import javax.swing.*;
  3. public class decimalFormat {
  4. public static void main(String[]args) {
  5.  
  6. DecimalFormat df= new DecimalFormat("##,##0.00");
  7. String s= JOptionPane.showInputDialog(null,"Please enter a number");
  8. s= df.format(s);
  9. double t=Double.parseDouble(s);
  10. JOptionPane.showMessageDialog(null,"Your number rounded to two digits is");
  11. }
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement