Advertisement
Guest User

Untitled

a guest
Jul 26th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.92 KB | None | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package mentormeetng2;
  7.  
  8. import java.text.DecimalFormat;
  9. import java.util.Scanner;
  10.  
  11. /**
  12.  *
  13.  * @author Savina
  14.  */
  15. public class MentorMeetng2 {
  16.  
  17.     /**
  18.      * @param args the command line arguments
  19.      */
  20.     public static void main(String[] args) {
  21.         Scanner scan = new Scanner(System.in);
  22.     DecimalFormat df = new DecimalFormat("#.##");
  23.     double a = 12.00;
  24.     double b = 12.01;
  25.     double c = 12.56342;
  26.     double d = 12.1;
  27.     double e = 12.10;
  28.         System.out.printf("%s%n", df.format(a));
  29.         System.out.printf("%s%n", df.format(b));
  30.         System.out.printf("%s%n", df.format(c));
  31.         System.out.printf("%s%n", df.format(d));
  32.         System.out.printf("%s%n", df.format(e));
  33.        
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement