Package java.util

Examples of java.util.Scanner.nextFloat()


      jos = new FileOutputStream("/tmp/" + fileName[i] + ".jpg");
      encoder.encodeImage(image, null, jos);
      Runtime rt = Runtime.getRuntime();
      Process pr = rt.exec("compare -metric PSNR data/test/JPEGImageUtilTestCase/truth/" + fileName[i] + ".ppm /tmp/" + fileName[i] + ".jpg /tmp/psnr.png");
      Scanner scanner = new Scanner(new InputStreamReader(pr.getErrorStream()));
      float psnr = scanner.hasNextFloat() ? scanner.nextFloat() : 0;
      assertTrue(fileName[i] + " PSNR is too low : " + psnr, psnr > 30);
    }
  }

}
View Full Code Here


      pos = new FileOutputStream("/tmp/" + fileName[i] + ".png");
      encoder.encodeImage(image, null, pos);
      Runtime rt = Runtime.getRuntime();
      Process pr = rt.exec("compare -metric MSE data/test/PNGImageUtilTestCase/truth/" + fileName[i] + ".ppm /tmp/" + fileName[i] + ".png /tmp/psnr.png");
      Scanner scanner = new Scanner(new InputStreamReader(pr.getErrorStream()));
      float mse = scanner.hasNextFloat() ? scanner.nextFloat() : -1;
      assertTrue(fileName[i] + " MSE is too high : " + mse, mse == 0);
    }
  }

}
View Full Code Here

public class E02 {
    public static void main(String[] args) {
        int c = 0;
        Scanner input = new Scanner(System.in);
        while(true){
            float car = input.nextFloat();
            if(car<=0){
                System.exit(0);
            }
            int comb = input.nextInt();
            switch(comb){
View Full Code Here

                    case 1:
                        tB1 = tB2 = tH = 0;
                       
                        System.out.println("\n Calcolo area del Trapezio.");
                        System.out.print(" Digitare un valore per la base minore:  ");
                        tB1 = inHandle.nextFloat();
                        System.out.print(" Digitare un valore per la base maggiore:  ");
                        tB2 = inHandle.nextFloat();
                        System.out.print(" Digitare un valore per l'altezza:  ");
                        tH = inHandle.nextFloat();
                       
View Full Code Here

                       
                        System.out.println("\n Calcolo area del Trapezio.");
                        System.out.print(" Digitare un valore per la base minore:  ");
                        tB1 = inHandle.nextFloat();
                        System.out.print(" Digitare un valore per la base maggiore:  ");
                        tB2 = inHandle.nextFloat();
                        System.out.print(" Digitare un valore per l'altezza:  ");
                        tH = inHandle.nextFloat();
                       
                        System.out.print("\n Area risultante:  " + CalcTrapezio(tB1, tB2, tH) + "\n");
                        break;
View Full Code Here

                        System.out.print(" Digitare un valore per la base minore:  ");
                        tB1 = inHandle.nextFloat();
                        System.out.print(" Digitare un valore per la base maggiore:  ");
                        tB2 = inHandle.nextFloat();
                        System.out.print(" Digitare un valore per l'altezza:  ");
                        tH = inHandle.nextFloat();
                       
                        System.out.print("\n Area risultante:  " + CalcTrapezio(tB1, tB2, tH) + "\n");
                        break;
                       
                    case 2:
View Full Code Here

                    case 2:
                        tD1 = tD2 = 0;
                       
                        System.out.println("\n Calcolo area del Rombo.");
                        System.out.print(" Digitare un valore per la diagonale minore:  ");
                        tD1 = inHandle.nextFloat();
                        System.out.print(" Digitare un valore per la diagonale maggiore:  ");
                        tD2 = inHandle.nextFloat();
                       
                        System.out.print("\n Area risultante:  " + CalcRombo(tD1, tD2) + "\n");
                        break;
View Full Code Here

                       
                        System.out.println("\n Calcolo area del Rombo.");
                        System.out.print(" Digitare un valore per la diagonale minore:  ");
                        tD1 = inHandle.nextFloat();
                        System.out.print(" Digitare un valore per la diagonale maggiore:  ");
                        tD2 = inHandle.nextFloat();
                       
                        System.out.print("\n Area risultante:  " + CalcRombo(tD1, tD2) + "\n");
                        break;
                       
                    case 3:
View Full Code Here

                    case 3:
                        tB1 = tH = 0;
                       
                        System.out.println("\n Calcolo area del Parallelogramma.");
                        System.out.print(" Digitare un valore per la base:  ");
                        tB1 = inHandle.nextFloat();
                        System.out.print(" Digitare un valore per l'altezza:  ");
                        tH = inHandle.nextFloat();
                       
                        System.out.print("\n Area risultante:  " + CalcParal(tB1, tH) + "\n");
                        break;
View Full Code Here

                       
                        System.out.println("\n Calcolo area del Parallelogramma.");
                        System.out.print(" Digitare un valore per la base:  ");
                        tB1 = inHandle.nextFloat();
                        System.out.print(" Digitare un valore per l'altezza:  ");
                        tH = inHandle.nextFloat();
                       
                        System.out.print("\n Area risultante:  " + CalcParal(tB1, tH) + "\n");
                        break;
                   
                    default:
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.