What is the error in this code? [closed]

-4

I did not understand the error of the code.

import java.util.Scanner;

public class Questao4 {
   public static void main (String[] args){
      Scanner scanner = new Scanner(System.in);
      double Altura, Fixo, Fixo2, PesoIdeal, Resultado1;

      Altura = 1,73; //Chute
      Fixo = 72,7;
      Fixo2 = 58;

      Resultado1 = Altura * Fixo;
      PesoIdeal = Resultado1 - Fixo2;

      System.out.print("Peso Ideal = " + PesoIdeal);
   }
}

When compiling, the following errors were detected:

Questao4.java:6: error: ';' expected
    Altura = 1,73; //Chute
Questao4.java:7: error: ';' expected
    Fixo = 72,7;
    
asked by anonymous 14.02.2018 / 16:25

1 answer

2

Floating-point numbers are separated by a decimal point, not by a decimal point.

In addition, variable names should start with lowercase letters , although the compiler will not complain about it, it is just a code convention.

Your corrected code:

import java.util.Scanner;

public class Questao4 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        double altura = 1.73; //Chute
        double fixo = 72.7;
        double fixo2 = 58;

        double resultado1 = altura * fixo;
        double pesoIdeal = resultado1 - fixo2;

        System.out.print("Peso Ideal = " + pesoIdeal);
    }
}
    
14.02.2018 / 17:05