Package java.util

Examples of java.util.Scanner.nextFloat()


      this.myHarness.fail ("#" + i + " : not double... (" + s.next () +
         ")");
    }
  if (s.hasNextFloat ())
    {
      aktFloat = s.nextFloat ();
      this.myHarness.check (aktFloat, floatZ[i],
          "#" + i + " : bad nextFloat() (" +
          aktFloat + " != " + floatZ[i]);
    }
  else
View Full Code Here


import java.util.Scanner;
public class InputExample {
public static void main(String args[ ]) throws IOException {
Scanner s = new Scanner(System.in);
System.out.print("Enter your height in centimeters: ");
float height = s.nextFloat();
System.out.print("Enter your weight in kilograms: ");
float weight = s.nextFloat();
float bmi = weight/(height*height)*10000;
System.out.println("Your body mass index is " + bmi + ".");
}
View Full Code Here

public static void main(String args[ ]) throws IOException {
Scanner s = new Scanner(System.in);
System.out.print("Enter your height in centimeters: ");
float height = s.nextFloat();
System.out.print("Enter your weight in kilograms: ");
float weight = s.nextFloat();
float bmi = weight/(height*height)*10000;
System.out.println("Your body mass index is " + bmi + ".");
}
}
View Full Code Here

public class InputExample {
public static void main(String args[ ]) throws IOException {
Scanner s = new Scanner(System.in);
System.out.print("Enter your height in centimeters: ");
float height = s.nextFloat();
System.out.print("Enter your weight in kilograms: ");
float weight = s.nextFloat();
float bmi = weight/(height*height)*10000;
System.out.println("Your body mass index is " + bmi + ".");

View Full Code Here

public static void main(String args[ ]) throws IOException {
Scanner s = new Scanner(System.in);
System.out.print("Enter your height in centimeters: ");
float height = s.nextFloat();
System.out.print("Enter your weight in kilograms: ");
float weight = s.nextFloat();
float bmi = weight/(height*height)*10000;
System.out.println("Your body mass index is " + bmi + ".");

System.out.printf("%8.2f", bmi);
String name = "Anish";
View Full Code Here

  public static void main(String[] args) {

    Scanner leitor = new Scanner(System.in);

    while (!leitor.next().equalsIgnoreCase("Nao")) {
      float valor = leitor.nextFloat();
      int ano = leitor.nextInt();
      float desconto = 0;
      float valorPago = 0;

      if (ano <= 2000) {
View Full Code Here

                                float fstart, fend, time;
                                fstart = fend = time = -1f;
                                Scanner scan = new Scanner(s);

                                if ( scan.hasNextFloat() ) {
                                    fstart = scan.nextFloat();

                                    if ( scan.hasNextFloat() ) {
                                        fend = scan.nextFloat();

                                        if ( scan.hasNextFloat() )
View Full Code Here

                                if ( scan.hasNextFloat() ) {
                                    fstart = scan.nextFloat();

                                    if ( scan.hasNextFloat() ) {
                                        fend = scan.nextFloat();

                                        if ( scan.hasNextFloat() )
                                            time = scan.nextFloat();
                                    }
                                }
View Full Code Here

                                    if ( scan.hasNextFloat() ) {
                                        fend = scan.nextFloat();

                                        if ( scan.hasNextFloat() )
                                            time = scan.nextFloat();
                                    }
                                }

                                if ( fstart >= 0 ) {
                                    if ( fend >= 0 ) {
View Full Code Here

    public static void main(String[] args) {
        Scanner teclado = new Scanner(System.in);
        double m, cm, pul, pie, yard;
        System.out.println("ingrese el numero de metros a convertir mayores a 1 ");
        float lm = teclado.nextFloat();
        System.out.println(" metros \t" + "/" + "yardas " + "/" + "\t pulgadas " + "/\t" + " pies ");
        for (m = 1; m <= lm; m++) {
            cm = m * 100;
            pul = cm / 2.54;
            pie = pul / 12;
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.