Advertisement
Guest User

FloatScanner

a guest
Sep 15th, 2011
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.75 KB | None | 0 0
  1. import java.io.*;
  2. import java.lang.*;
  3. import java.util.*;
  4.  
  5. public class FloatScanner
  6. {
  7.     public static void main( String args[] )
  8.     {
  9.         Scanner in = new Scanner(System.in);
  10.         float minSup, minConf;
  11.        
  12.         minSup = minConf = 0.0F;
  13.        
  14.         do
  15.         {
  16.             System.out.println("1)Insert a float value : ");
  17.             minSup = in.nextFloat();
  18.             // Dovresti inserire i valori semplicemente con la virgola, ( es. 0,33 -> 0.33 ) altrimenti generi un'eccezione di tipo InputMismatchException
  19.             // che dovresti eventualmente gestire!
  20.            
  21.         } while ( minSup < 0.2 );
  22.        
  23.         System.out.println("MINSUP : " + minSup);
  24.         do
  25.         {
  26.             System.out.println("2)Insert a float value : ");
  27.             minConf = in.nextFloat();
  28.        
  29.         } while ( minConf < 0.3 );
  30.        
  31.         System.out.println("MINCONF : " + minConf);
  32.    
  33.     }
  34.  
  35.  
  36.  
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement